Mr Clevver
Idiot Savant
- Local time
- Today, 11:14
- Joined
- Jun 26, 2008
- Messages
- 17
Hi all,
Not sure this is in the correct area, as the issue covers a multitude of areas, but here goes:
I have an issue that has started occurring after I upsized my system to run on an SQL backend.
I have a form (fMainMenu) which has a textbox (txtDate). The forms also contains seven subforms which reference a table called tEvents.
txtDate contains the value Date() and can be altered by three buttons, which push the date forward 7 days, backward 7 days or return to todays date.
Each of the 7 subforms displays the events contained within tEvents, corresponding to a specific day of the week, by means of limiting their data with the expression:
Mon
EventDate = [Forms]![fMainMenu]![txtDate]+(2-Weekday(Date()))
Tue
EventDate = [Forms]![fMainMenu]![txtDate]+(2-Weekday(Date())) +1
Wed
EventDate = [Forms]![fMainMenu]![txtDate]+(2-Weekday(Date())) +2
etc.
This seemed to work very well until the afore mentioned upsize to SQL, but now the all the subforms seem to be returning all the events for 2 days in the future (i.e. Monday displays Wednesday's etc.). Interestingly, the form header for each subform, which contains a textbox set to display
[Forms]![fMainMenu]![txtDate]+(2-Weekday(Date())) still displays correctly. This makes me think that there is some difference in the way SQL handles requests based on date information.
Preferably I'd like to understand why it is that SQL is doing this, but failing that anything that gets the system working the way it should would be appreciated.
Thank you in advance.
Edit - An obvious work-around, which has just struck me, in the form of simply adding -2 to the end of each date expression:
Mon
EventDate = ([Forms]![fMainMenu]![txtDate]+(2-Weekday(Date()))) -2
seems to be working, but it's clunky, and I'd still rather understand why it's happening.
Not sure this is in the correct area, as the issue covers a multitude of areas, but here goes:
I have an issue that has started occurring after I upsized my system to run on an SQL backend.
I have a form (fMainMenu) which has a textbox (txtDate). The forms also contains seven subforms which reference a table called tEvents.
txtDate contains the value Date() and can be altered by three buttons, which push the date forward 7 days, backward 7 days or return to todays date.
Each of the 7 subforms displays the events contained within tEvents, corresponding to a specific day of the week, by means of limiting their data with the expression:
Mon
EventDate = [Forms]![fMainMenu]![txtDate]+(2-Weekday(Date()))
Tue
EventDate = [Forms]![fMainMenu]![txtDate]+(2-Weekday(Date())) +1
Wed
EventDate = [Forms]![fMainMenu]![txtDate]+(2-Weekday(Date())) +2
etc.
This seemed to work very well until the afore mentioned upsize to SQL, but now the all the subforms seem to be returning all the events for 2 days in the future (i.e. Monday displays Wednesday's etc.). Interestingly, the form header for each subform, which contains a textbox set to display
[Forms]![fMainMenu]![txtDate]+(2-Weekday(Date())) still displays correctly. This makes me think that there is some difference in the way SQL handles requests based on date information.
Preferably I'd like to understand why it is that SQL is doing this, but failing that anything that gets the system working the way it should would be appreciated.
Thank you in advance.
Edit - An obvious work-around, which has just struck me, in the form of simply adding -2 to the end of each date expression:
Mon
EventDate = ([Forms]![fMainMenu]![txtDate]+(2-Weekday(Date()))) -2
seems to be working, but it's clunky, and I'd still rather understand why it's happening.
Last edited: