Save buton

  • Thread starter Thread starter Allen Browne
  • Start date Start date
A

Allen Browne

Try:
If Me.Dirty Then Me.Dirty = False
or if you prefer:
RunCommand acCmdSaveRecord
 
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
 
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
 
Back
Top