Query on Date / Time field - X number of days

jereece

Registered User.
Local time
Today, 16:08
Joined
Dec 11, 2001
Messages
300
I have a query for a report hitting a SQL database. One of the fields is Date-Time in this format [11/16/2011 5:46:00 PM]. I have a form with a combo box with simple numbers 1-10. In the Date-Time field of my query I have the following
Code:
>Date()-[Forms]![frm_Main]![cboMinusDays]
This way I can select the number of days I want the report to look back. The only problem is I have to select 3 in the combo box in order for the report to look back 1 day. If I select 1 or 2 in the combo box I always get nothing. Selecting 3 I will get the data entered yesterday. Using Access 2007.

Any suggestions on how to fix this problem?

As always I appreciate the help.
Jim
 
I am not familiar with the DateAdd() function and after reviewing your link I am still not sure how to use it with what I am trying to accomplish. Can you give me an example how I could use it with what I am trying to do?
 
I gave you some new information and a page explaining what the function does. You should have tried to incorporate that into your code. That's the new code I would like to see so we can take it from there.
 

Users who are viewing this thread

Back
Top Bottom