Hi Guys,
Ran into a problem with my SELECT Query and unsure what it is
My program at large is a calendar that is searching the database for any bookings for the shown month. The specific code where the problem is occuring is the part where it searches for any existing bookings, then populates the labels of my calendar. Another question I did have is whether CurrentDb.Execute fails - for lack of a better term - queitly and if it will produce an error if there is no record found.
Anyway the code is below and I hope you can see something I can't!!
Ran into a problem with my SELECT Query and unsure what it is
My program at large is a calendar that is searching the database for any bookings for the shown month. The specific code where the problem is occuring is the part where it searches for any existing bookings, then populates the labels of my calendar. Another question I did have is whether CurrentDb.Execute fails - for lack of a better term - queitly and if it will produce an error if there is no record found.
Anyway the code is below and I hope you can see something I can't!!
Code:
Counter = 1
For Counter = 1 To DaysOfMonth
BookingID = 0
Label = "lblInfo" & FirstSearch
TempDate = Counter & "/" & CurrentMonth & "/" & CurrentYear
SQL = "SELECT BookingID FROM tblFlightsBooked WHERE DateOfFlight = " & TempDate
bID = CurrentDb.Execute(SQL)
If bID <> 0 Then
TimeStart = DLookup("TimeStart", "tblFlightsBooked", "BookingID = " & bID)
TimeFinish = DLookup("TimeFinish", "tblFlightsBooked", "BookingID = " & bID)
Me.Controls(Label).Caption = Chr(13) & Chr(10) & TimeStart & "-" & TimeFinish
End If
FirstSearch = FirstSearch + 1
Next Counter