A
Alias
Hello all,
Is it possible to do the following with NEW RECORDS ONLY:
1. Prevent record saves if FullName field is blank.
2. Allow move from record if fields dirty, but DON'T SAVE if FullName is
still blank.
I'm trying code below in OnExit property, but data still saves. Can someone
help me fix the code, or write a new code that will work:
Private Sub Dept_Exit(Cancel As Integer)
Dim intnewrec As Integer
intnewrec = Form.NewRecord
If intnewrec = True Then
If IsNull(Me.FullName.Value) And Me.Dirty Then
MsgBox "Employee field cannot be left blank."
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdUndo
DoCmd.SetWarnings True
End If
End If
End Sub
Is it possible to do the following with NEW RECORDS ONLY:
1. Prevent record saves if FullName field is blank.
2. Allow move from record if fields dirty, but DON'T SAVE if FullName is
still blank.
I'm trying code below in OnExit property, but data still saves. Can someone
help me fix the code, or write a new code that will work:
Private Sub Dept_Exit(Cancel As Integer)
Dim intnewrec As Integer
intnewrec = Form.NewRecord
If intnewrec = True Then
If IsNull(Me.FullName.Value) And Me.Dirty Then
MsgBox "Employee field cannot be left blank."
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdUndo
DoCmd.SetWarnings True
End If
End If
End Sub