i have a few text boxes. First is ATA which is actual time of arrival (for airplanes), second is inboundFirst (for baggage) and inboundLast. What happens is that if the user enters a time of 13:00, which is then converted to short time, into ATA, and lets say 13:30 into inboundFirst, VB compares the two fields to check weather or not the time inboundFirst is within 10 minutes of ATA. here is the following code.
Private Sub inboundFirst_Exit(Cancel As Integer)
Dim TimeValue As Double
TimeValue = Me.inboundFirst.Value - Me.ATA.Value
'MsgBox TimeValue, , "Time Value"
'Baggage time for Westjet
If Me.Airline = "WS" Then
If TimeValue > (1 / 1440) * 11 Then
MsgBox "First Bag Time not Met for WestJet"
Me.Include_on_Shift_Report.Value = True
Me.Include_on_Shift_Report.Locked = True
Else
MsgBox "First Bag Time was met"
Me.Include_on_Shift_Report.Locked = False
End If
End If
What happens is that if the user clicks onto the inboundFirst field, and decides to not enter anything, and moves on to next field, i get an error saying:
Run-time error "94",
Invalid use of null
i tried myself to to data validation by entering this into:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(inboundFirst) Then
If MsgBox("You did not enter an Inbound First Bag Time. Continue Anyway?", _
vbYesNo + vbQuestion, ApplicationName) = vbNo Then
Cancel = True
inboundFirst.SetFocus
End If
End If
and nothing works, can anyone help me figure out the proper steps to either trap the error, or possibly fix what i have coded?
Thanks
Private Sub inboundFirst_Exit(Cancel As Integer)
Dim TimeValue As Double
TimeValue = Me.inboundFirst.Value - Me.ATA.Value
'MsgBox TimeValue, , "Time Value"
'Baggage time for Westjet
If Me.Airline = "WS" Then
If TimeValue > (1 / 1440) * 11 Then
MsgBox "First Bag Time not Met for WestJet"
Me.Include_on_Shift_Report.Value = True
Me.Include_on_Shift_Report.Locked = True
Else
MsgBox "First Bag Time was met"
Me.Include_on_Shift_Report.Locked = False
End If
End If
What happens is that if the user clicks onto the inboundFirst field, and decides to not enter anything, and moves on to next field, i get an error saying:
Run-time error "94",
Invalid use of null
i tried myself to to data validation by entering this into:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(inboundFirst) Then
If MsgBox("You did not enter an Inbound First Bag Time. Continue Anyway?", _
vbYesNo + vbQuestion, ApplicationName) = vbNo Then
Cancel = True
inboundFirst.SetFocus
End If
End If
and nothing works, can anyone help me figure out the proper steps to either trap the error, or possibly fix what i have coded?
Thanks