Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim ctl As Control
Dim CName As String
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acOptionGroup
If Nz(ctl, "") = "" Then
CName = ctl.Controls(0).Caption
MsgBox CName & " is Required", vbCritical, "Required Field Missing"
Cancel = True
ctl.SetFocus
Exit Sub
End If
End Select
Next ctl
If Not (Me.NewRecord) Then
If MsgBox("Would You Like To Save The Changes To This Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save Changes to Record ???") = vbNo Then
Me.Undo
End If
Else
If MsgBox("Would You Like To Save This New Record?", vbQuestion + vbYesNo + vbDefaultButton1, "Save This New Record ???") = vbNo Then
Me.Undo
End If
End If
End Sub