Cowboy_BeBa
Registered User.
- Local time
- Tomorrow, 03:30
- Joined
- Nov 30, 2010
- Messages
- 188
Hi all
So i have a report that, among other things, shows us stock ordered between today (the current date) and the last 3 months.
The query criteria under the date field is as follows:
Between DateAdd("m",-3,Date()) And Date()
nice and simple and works perfectly
However now there is a new need. Some times they would like to run the query to get it between two certain dates.
Now i can do this easily by editing the query, however i am the only computer literate person in the office and i am the only one able to make edits (have locked the front end down so that nobody else can edit a thing unless they enter myu username and password). As im not always in the office it is not always practical for them to come to me
Ive added two text boxes to the main menu form (next to the button that opens this report) txtD1 and txtD2
the idea is for the users to click the button with the two fields blank if they wanna just rund the form as before, or to enter in two dates if they want to run the report between those dates (tried getting a date picking combo box but sadly it seemed too tricky to implement in the time i had allocated to solve this problem, so went with two text boxes)
convoluted i know, but i figured this would be the best solution (am open to suggestions), in an effort to make this work i wrote the following criteria to replace the old one:
iif(Forms![frmMainMenu]![txtD1]="", Between DateAdd("m",-3,Date()) And Date(), iif(Forms![frmMainMenu]![txtD2]="", Between DateAdd("m",-3,Date()) And Date(), Between "#"&Forms![frmMainMenu]![txtD1]&"#" And "#"&Forms![frmMainMenu]![txtD2]&"#"))
have tried using = null and ="", have tried running the query with both of those, with the text boxes blank and with them full, however in all occasions it returns no records (even though the dates im using definitely should be returning records
can anyone see what im doing wrong here?
iif(Forms![frmMainMenu]![txtD1]="", Between DateAdd("m",-3,Date()) And Date(), iif(Forms![frmMainMenu]![txtD2]="", Between DateAdd("m",-3,Date()) And Date(), Between "#"&Forms![frmMainMenu]![txtD1]&"#" And "#"&Forms![frmMainMenu]![txtD2]&"#"))
thanks,
Ben
So i have a report that, among other things, shows us stock ordered between today (the current date) and the last 3 months.
The query criteria under the date field is as follows:
Between DateAdd("m",-3,Date()) And Date()
nice and simple and works perfectly
However now there is a new need. Some times they would like to run the query to get it between two certain dates.
Now i can do this easily by editing the query, however i am the only computer literate person in the office and i am the only one able to make edits (have locked the front end down so that nobody else can edit a thing unless they enter myu username and password). As im not always in the office it is not always practical for them to come to me
Ive added two text boxes to the main menu form (next to the button that opens this report) txtD1 and txtD2
the idea is for the users to click the button with the two fields blank if they wanna just rund the form as before, or to enter in two dates if they want to run the report between those dates (tried getting a date picking combo box but sadly it seemed too tricky to implement in the time i had allocated to solve this problem, so went with two text boxes)
convoluted i know, but i figured this would be the best solution (am open to suggestions), in an effort to make this work i wrote the following criteria to replace the old one:
iif(Forms![frmMainMenu]![txtD1]="", Between DateAdd("m",-3,Date()) And Date(), iif(Forms![frmMainMenu]![txtD2]="", Between DateAdd("m",-3,Date()) And Date(), Between "#"&Forms![frmMainMenu]![txtD1]&"#" And "#"&Forms![frmMainMenu]![txtD2]&"#"))
have tried using = null and ="", have tried running the query with both of those, with the text boxes blank and with them full, however in all occasions it returns no records (even though the dates im using definitely should be returning records
can anyone see what im doing wrong here?
iif(Forms![frmMainMenu]![txtD1]="", Between DateAdd("m",-3,Date()) And Date(), iif(Forms![frmMainMenu]![txtD2]="", Between DateAdd("m",-3,Date()) And Date(), Between "#"&Forms![frmMainMenu]![txtD1]&"#" And "#"&Forms![frmMainMenu]![txtD2]&"#"))
thanks,
Ben