G
Guest
I read SandyR's post but could not solve my problem.
In a form, I am trying to make the user enter a date of employee transfer or
seperation (Unassignment). If the user checks either the Transfer box or
Archive box and does not enter the date, I want a message telling the user to
enter the date before saving the record. I get a Run-time Error "424" on this
line of code >If Me.Archive = True And Me.Unassignment_Date Is Null Then<
This code is in the Form, Before Update, Event.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMessage As String
strMessage = "You must enter the Unassignment Date before you continue."
If Me.Archive = True And Me.Unassignment_Date Is Null Then
MsgBox strMessage, vbExclamation, "Missing Unassignment Date"
Cancel = True
End If
End Sub
*****************
On the following version I get an error "Compile Error, Object Required".
The complaining line of code is >Set dtmUpdate =<
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMessage As String
Dim dtmUpdate As Date
Set dtmUpdate = Me.Unassignment_Date
strMessage = "You must enter the Unassignment Date before you continue."
If Me.Archive = True And dtmUpdate Is Null Then
MsgBox strMessage, vbExclamation, "Missing Unassignment Date"
Cancel = True
End If
End Sub
What do you think?
Thanks,
Dennis
In a form, I am trying to make the user enter a date of employee transfer or
seperation (Unassignment). If the user checks either the Transfer box or
Archive box and does not enter the date, I want a message telling the user to
enter the date before saving the record. I get a Run-time Error "424" on this
line of code >If Me.Archive = True And Me.Unassignment_Date Is Null Then<
This code is in the Form, Before Update, Event.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMessage As String
strMessage = "You must enter the Unassignment Date before you continue."
If Me.Archive = True And Me.Unassignment_Date Is Null Then
MsgBox strMessage, vbExclamation, "Missing Unassignment Date"
Cancel = True
End If
End Sub
*****************
On the following version I get an error "Compile Error, Object Required".
The complaining line of code is >Set dtmUpdate =<
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMessage As String
Dim dtmUpdate As Date
Set dtmUpdate = Me.Unassignment_Date
strMessage = "You must enter the Unassignment Date before you continue."
If Me.Archive = True And dtmUpdate Is Null Then
MsgBox strMessage, vbExclamation, "Missing Unassignment Date"
Cancel = True
End If
End Sub
What do you think?
Thanks,
Dennis