Hello!
Please bear with me i'm a total rookie.
I am trying to prevent operators from filling out my "inspections log" form before they have entered the hours the are working that day in the "inspectors' hours" table through a form also called "inspectors' hours".
in order to do so, i am using a dlookup function on the before update event in my "hours" field in the "inspections log" form that looks up if there are any hours entered for that day for that operator in the "inspectors' hours" table. This is what I got:
Private Sub Inspector_Name_BeforeUpdate(Cancel As Integer)
Dim icount As Long
icount = Nz(DLookup("Hours", "Inspectors' Hours", "Inspector=" & [Inspector] & " And Date= #" & [Date] & "#"), 0)
If icount = 0 Then
MsgBox "Please enter the hours you are working today before filling the inspections log."
Cancel = True
Undo
End If
End Sub
I am having all kinds of trouble with it. I am getting the "Compile Error: External name not defined" error message when I run the nz(dlookup) function, but it works fine when i take out the date part...
any ideas?
Thank you!