I have several forms with this problem...when a Save command button using code below is clicked, my other command buttons (which close the form or add a new record) won't work. I don't get an error message or anything, unless I click on Save again, and then I am told that Save is unavailable.
The Close and Add commands first use a true Me.Dirty statement to check req'd fields for null, force users to enter required information, and then save the record before closing or adding or they go straight to the close/add commands if Me.Dirty is false. These commands work if I haven't click the Save command first. Here is the Save code:
Private Sub Save_Click()
On Error GoTo Err_Save_Click
Dim Fld1 As Control '(etc)
Set Fld1 = Me("Product"
'...and so on for the rest of the fields
If IsNull(Fld1) Then
MsgBox "Record cannot be saved until required fields have data.", vbOKOnly
Fld1.SetFocus
Exit Sub
'...and so on for the rest of the fields
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
Exit_Save_Click:
Exit Sub
Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click
End Sub
Thanks in advance for any thoughts,
tgikristi
The Close and Add commands first use a true Me.Dirty statement to check req'd fields for null, force users to enter required information, and then save the record before closing or adding or they go straight to the close/add commands if Me.Dirty is false. These commands work if I haven't click the Save command first. Here is the Save code:
Private Sub Save_Click()
On Error GoTo Err_Save_Click
Dim Fld1 As Control '(etc)
Set Fld1 = Me("Product"
'...and so on for the rest of the fields
If IsNull(Fld1) Then
MsgBox "Record cannot be saved until required fields have data.", vbOKOnly
Fld1.SetFocus
Exit Sub
'...and so on for the rest of the fields
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
Exit_Save_Click:
Exit Sub
Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click
End Sub
Thanks in advance for any thoughts,
tgikristi