Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2005

Tip: Looking for answers? Try searching our database.

Save buton

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Khalil - 30 Jul 2005 11:38 GMT
Hi,
I have a form with a button for add new record that works fine. I added a
second button to save the current record.
I need two things:
1- after user fills all the fields in the form I do not want to move to the
next new reord.
2- Add a save button so that the record is saved.
I tried the follwing code for saving the record but it does not work:

Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click

   Dim stDocName As String

   stDocName = "frmTagEmployeeSample"
   DoCmd.Save stDocName

Exit_cmdSave_Click:
   Exit Sub

Err_cmdSave_Click:
   MsgBox Err.Description
   Resume Exit_cmdSave_Click

End Sub

Can any one help with the code?
Khalil
Allen Browne - 30 Jul 2005 11:53 GMT
Try:
   If Me.Dirty Then Me.Dirty = False
or if you prefer:
   RunCommand acCmdSaveRecord

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> I have a form with a button for add new record that works fine. I added a
> second button to save the current record.
[quoted text clipped - 24 lines]
> Can any one help with the code?
> Khalil
Jörg Ackermann - 30 Jul 2005 11:53 GMT
Hi,

Khalil schreibselte:

> Hi,
> I have a form with a button for add new record that works fine. I
> added a second button to save the current record.
> I need two things:
> 1- after user fills all the fields in the form I do not want to move
> to the next new reord.

Set the Cycle-Property of the form to 'actual Record'

> 2- Add a save button so that the record is saved.

Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click

   Me.Dirty = False

Exit_cmdSave_Click:
   Exit Sub
Err_cmdSave_Click:
   MsgBox Err.Description
   Resume Exit_cmdSave_Click
End Sub

or

Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click

   Docmd.RunCommand accmdSaveRecord

Exit_cmdSave_Click:
   Exit Sub
Err_cmdSave_Click:
   MsgBox Err.Description
   Resume Exit_cmdSave_Click
End Sub

Acki
Khalil - 30 Jul 2005 12:02 GMT
Thanks a lot
Khalil
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.