I have this application that I have been using for over 8 month or more now but the boss wants to make a change. In our parking lot, drivers come in from 7:00 AM to 5:00 PM while we are open. If someone comes in before 11:00 AM The rate is given with a case statement in increments of $2 every 20 Min but if the driver wants to stay all day up to 5:00 the Max is $12:00. After 11:00 AM it is the same thing except that the MAX is only $7:00. I am trying to accomplish that with the following case but not only is not working it is giving me error on line color in bold RED. Can someone explain how I can compare the value of TimeIn with the time 11:00 AM and use each case base on that?
Private Sub FindTAG_AfterUpdate()
If Me.FindTAG & vbNullString <> vbNullString Then
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "[TAG]=" & Me.FindTAG
If rs.NoMatch Then
DoCmd.GoToRecord acActiveDataObject, , acNewRec
Me!TAG = Me.FindTAG
Me.TimeIn = Now()
Me.HourlyRate = 6
MsgBox "Ticket Added, Click 'OK' To Continue!"
DoCmd.GoToRecord acDataForm, "CTPLLC", acNewRec
Forms!CTPLLC!FindTAG.SetFocus
Else
Me.Bookmark = rs.Bookmark
If IsNull(Me.TimeOut) Then
Me.TimeOut = Now()
Me.ElapsedTime = DateDiff("n", [TimeIn], [TimeOut])
Y = TimeIn
If Y > #Date()11:00:01 AM#Then
Select Case [ElapsedTime]
Case 1 To 21
X = 2
Case 22 To 41
X = 4
Case 42 To 61
X = 6
Case 62 To 10000
X = 7
End Select
Else
Select Case [ElapsedTime]
Case 1 To 21
X = 2
Case 22 To 41
X = 4
Case 42 To 61
X = 6
Case 62 To 81
X = 8
Case 82 To 101
X = 10
Case 102 To 10000
X = 12
End Select
End If
Me.AmountOwed = X
If Me.Dirty Then
Me.Dirty = False
End If
Else
MsgBox "NOTICE:This is a previously Used Ticket!"
Forms!CTPLLC!Next.SetFocus
End If
End If
rs.Close
FindTAG = Null
End If
End Sub