I'm using Access 97 SR-2 on Windows XP to develop an Inventory style database that has some functionality, but having a problem making my query dynamic. I have a switchboard style form which I choose from a selection of 3 command buttons to select a Due Date for record reviews, choices being 30 days, 60 days, and 120 days. When I click on one of the buttons, A public variable, mqryDueDate, is set, for example, to today's date + 30 days, and is of 'Date' type in the declarations. This variable is then used in my query to pull all records which have a due date within the next 30 days. Simple stuff I thought, but the way I have my code and SQL statement, I have no records returned. If I have the query prompt me to manualy enter a date, the correct records ARE returned, but it's when trying to pass the variable data through to the query, nothing is returned. Using the command button's OnClick event, the following (relevant) VBA code is run...
The report's record source is a query called qryDueDate, and contains a SQL statement which is supposed to capture the value of variable mqryDueDate and return records based on..
However, no results are returned, and no error is received.
I have had a look at various posts regarding this kind of situation, but no resolve was found. I am suspecting it's that my version of Access isn't able to do this, or I've typed in the WHERE statement wrong.
Any help would be appreciated, and if I've forgotten to provide any information (as per posting guidelines), I do apologise.
thanks...
Code:
mqryDueDate = Date + 30 DoCmd.OpenReport "rptDueDate", acViewPreview
Code:
WHERE (((AllInstructions.DueDate)< [Forms]![frmReportByDueDate]!mqryDueDate));
I have had a look at various posts regarding this kind of situation, but no resolve was found. I am suspecting it's that my version of Access isn't able to do this, or I've typed in the WHERE statement wrong.
Any help would be appreciated, and if I've forgotten to provide any information (as per posting guidelines), I do apologise.
thanks...
Comment