G
Guest
continued from a post on Sunday 8/12/2007
Could someone please tell me if I am close with this code or am I completly
off track.
What I want to achieve is: If the user is entering trainers onto a roster
and they select a trainer who will be on leave on that date, I want them to
receive a message telling them the trainer is not available.
The form has these controls
TrainerId
TrainerName
RosterdDate
StartTime
EndTime
I also have a table for leave which is tblTrainerLeave and has the following
controls
TrainerID
LeaveStartDate
LeaveEndDate
Private Sub TrainerID_BeforeUpdate(Cancel As Integer)
If Me.TrainerID = [tblTrainerLeave].[TrainerID] Then
If Me.RosterDate >= [tblTrainerLeave].[LeaveStartDate] Then
If Me.RosterDate <= [tblTrainerLeave].[LeaveEndDate] Then
MsgBox "This trainer is on leave from
[tblTrainerLeave].[LeaveStartDate] to [tblTrainerLeave].[LeaveEndDate] please
select another trainer."
End If
End If
End If
End Sub
I keep receiving this error
Run-time error '2465':
can't find the field 'l' referred to in your expression.
I have know idea what field it's talking, I can't find it at all.
Thank you in advance
Rodney
Could someone please tell me if I am close with this code or am I completly
off track.
What I want to achieve is: If the user is entering trainers onto a roster
and they select a trainer who will be on leave on that date, I want them to
receive a message telling them the trainer is not available.
The form has these controls
TrainerId
TrainerName
RosterdDate
StartTime
EndTime
I also have a table for leave which is tblTrainerLeave and has the following
controls
TrainerID
LeaveStartDate
LeaveEndDate
Private Sub TrainerID_BeforeUpdate(Cancel As Integer)
If Me.TrainerID = [tblTrainerLeave].[TrainerID] Then
If Me.RosterDate >= [tblTrainerLeave].[LeaveStartDate] Then
If Me.RosterDate <= [tblTrainerLeave].[LeaveEndDate] Then
MsgBox "This trainer is on leave from
[tblTrainerLeave].[LeaveStartDate] to [tblTrainerLeave].[LeaveEndDate] please
select another trainer."
End If
End If
End If
End Sub
I keep receiving this error
Run-time error '2465':
can't find the field 'l' referred to in your expression.
I have know idea what field it's talking, I can't find it at all.
Thank you in advance
Rodney