A
AngiW
I'm getting an error I've never seen before and the help is blank, so
hopefully, someone can help me. The only thing I can think of is that
technically, the dlookup isn't right. The Hours field is in the positions
table that is connected to the employee main table with key Position, which is
then connected to the Used table with the employee id key. But I don't think
this is the error I would've received if that was the problem. Is there a way
to connect two tables that are connected by another table? The msgbox is wrong
too...have to work on that next.
Run-time error '2001':
You canceled the previous operation.
I didn't do anything, but tab out of the field. Here's my code:
Private Sub To_Exit(Cancel As Integer)
Dim Msg2, Style, response
Dim DaysUsed, HoursUsed
Msg2 = "Total hours taken: " & HoursUsed
Style = vbOKOnly + vbExclamation
DaysUsed = DateDiff("d", Me.From, Me.To)
HoursUsed = DaysUsed * (DLookup("[Hours]", "employee main", "[Employee ID] =" &
Me.EmployeeID))
response = MsgBox(Msg2, Style)
End Sub
hopefully, someone can help me. The only thing I can think of is that
technically, the dlookup isn't right. The Hours field is in the positions
table that is connected to the employee main table with key Position, which is
then connected to the Used table with the employee id key. But I don't think
this is the error I would've received if that was the problem. Is there a way
to connect two tables that are connected by another table? The msgbox is wrong
too...have to work on that next.
Run-time error '2001':
You canceled the previous operation.
I didn't do anything, but tab out of the field. Here's my code:
Private Sub To_Exit(Cancel As Integer)
Dim Msg2, Style, response
Dim DaysUsed, HoursUsed
Msg2 = "Total hours taken: " & HoursUsed
Style = vbOKOnly + vbExclamation
DaysUsed = DateDiff("d", Me.From, Me.To)
HoursUsed = DaysUsed * (DLookup("[Hours]", "employee main", "[Employee ID] =" &
Me.EmployeeID))
response = MsgBox(Msg2, Style)
End Sub