I have a form with an unbound combo box that allows user to select from a list of existing client names.
The user then inputs the new name of the client into an unbound text box and then indicates the effective date of the name change.
I'm trying to introduce a validation check to make sure that the effective date falls AFTER the effective date of the client's most recent name change. But I'm experiencing some "glitches". (Nothing new there !)
Here is the curent coding. Any suggestions ?
Private Sub ubdEffectiveDate_BeforeUpdate(Cancel As Integer)
'Check the validity of the proposed new effective date
Dim dEffectiveDate As Date
dEffectiveDate = DLookup("EffectiveDate", "tblClientName", "ClientName = " & Chr(34) & Me.cboClientName & Chr(34)
If ubdEffectiveDate < dEffectiveDate Then
MsgBox "You must choose a later date."
Cancel = True
Me.ubdEffectiveDate.Undo
DoCmd.RunCommand acCmdDelete
End If
End Sub
The user then inputs the new name of the client into an unbound text box and then indicates the effective date of the name change.
I'm trying to introduce a validation check to make sure that the effective date falls AFTER the effective date of the client's most recent name change. But I'm experiencing some "glitches". (Nothing new there !)
Here is the curent coding. Any suggestions ?
Private Sub ubdEffectiveDate_BeforeUpdate(Cancel As Integer)
'Check the validity of the proposed new effective date
Dim dEffectiveDate As Date
dEffectiveDate = DLookup("EffectiveDate", "tblClientName", "ClientName = " & Chr(34) & Me.cboClientName & Chr(34)
If ubdEffectiveDate < dEffectiveDate Then
MsgBox "You must choose a later date."
Cancel = True
Me.ubdEffectiveDate.Undo
DoCmd.RunCommand acCmdDelete
End If
End Sub