S
shanebgross
My database keeps track of vehicle maintenance. I have a form to enter all
information. I want an message box and cancelevent to occur if a record for
a specific vehichle chosen from a combo box on the form already has a record
for a date entered in a text box on the same form. I have a query called
date validator that finds any record with the same date as the date text box
on the form and the same vehichle ID as chosen in the combo box. I have the
following code on the form's beforeupdate event:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If DLookup("[Date]", "Date Validator", "[Date]=" &
Forms!Maintenance!Text7) Is Null Then
MsgBox "An entry for this vehicle already exists with this date." &
Chr(13) & "Click OK to change the vehicle and/or date or Cancel to abort this
entry.", 5 + 16 , "Entry already exists!"
End If
End Sub
I get Error 424--Object required when I try to go to the next record. What
is wrong? I can make it work with a macro, but I want an "ok" and "cancel"
button on the message box to give the person entering options.
information. I want an message box and cancelevent to occur if a record for
a specific vehichle chosen from a combo box on the form already has a record
for a date entered in a text box on the same form. I have a query called
date validator that finds any record with the same date as the date text box
on the form and the same vehichle ID as chosen in the combo box. I have the
following code on the form's beforeupdate event:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If DLookup("[Date]", "Date Validator", "[Date]=" &
Forms!Maintenance!Text7) Is Null Then
MsgBox "An entry for this vehicle already exists with this date." &
Chr(13) & "Click OK to change the vehicle and/or date or Cancel to abort this
entry.", 5 + 16 , "Entry already exists!"
End If
End Sub
I get Error 424--Object required when I try to go to the next record. What
is wrong? I can make it work with a macro, but I want an "ok" and "cancel"
button on the message box to give the person entering options.