Hi, New here so thanks in advance.
I have a section of code on the OnClick event of a button, what it is supposed to do is take the date from the Form on which the button is placed - Form Name - [Dispatch] - Date Field - [dteDate]
Then add one day to the date above and requery a table for all records on this new date.
The code is as follows
Dim DateTomorrow As Date
Dim Day1 As Date
Day1 = [Forms]![Dispatch]![dteDate]
[DateTomorrow] = DateAdd("d", 1, [Day1])
Forms.Dispatch.RecordSource = "Select tbl_Record.* FROM" & _
" tbl_Record WHERE ((tbl_Record.DateR) = #" & [DateTomorrow] & "#)" & _
"Order By tbl_Record.TimeSlot"
Now the problem is that this works perfectly, until I hit the end of the month. It stops adding up the date correctly and returns results for 05/01/2010, When it should be 01/05/2010, then 02/05/2010 and so on.
Any ideas?
Thanks!
I have a section of code on the OnClick event of a button, what it is supposed to do is take the date from the Form on which the button is placed - Form Name - [Dispatch] - Date Field - [dteDate]
Then add one day to the date above and requery a table for all records on this new date.
The code is as follows
Dim DateTomorrow As Date
Dim Day1 As Date
Day1 = [Forms]![Dispatch]![dteDate]
[DateTomorrow] = DateAdd("d", 1, [Day1])
Forms.Dispatch.RecordSource = "Select tbl_Record.* FROM" & _
" tbl_Record WHERE ((tbl_Record.DateR) = #" & [DateTomorrow] & "#)" & _
"Order By tbl_Record.TimeSlot"
Now the problem is that this works perfectly, until I hit the end of the month. It stops adding up the date correctly and returns results for 05/01/2010, When it should be 01/05/2010, then 02/05/2010 and so on.
Any ideas?
Thanks!