Computing.Net > Forums > Office Software > Access Query BETWEEN statement

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Access Query BETWEEN statement

Reply to Message Icon

Name: themick
Date: April 4, 2005 at 14:43:03 Pacific
OS: Win98SE/XP
CPU/Ram: P4/512K
Comment:

I have a field in my DB called "DateOpened". I need to run a query that will scan these dates and return to me, for example, all files opened between 2/1/<any year> and 2/28/<any year>. I tried using a * wildcard but Access does not allow for that. Thanks




Sponsored Link
Ads by Google

Response Number 1
Name: Jennifer SUMN
Date: April 4, 2005 at 15:43:44 Pacific
Reply:

In the Criteria line of the "DateOpened" field in your database, enter the following:

Between [Please Enter Starting Date] And [Please Enter Ending Date]

Then when you run the query, enter the dates in the same format as the field.


0

Response Number 2
Name: themick
Date: April 4, 2005 at 15:51:13 Pacific
Reply:

Thanks Jennifer,

I got that far - the problem is I need the query to pull for example, all data between those two time periods (2/1 - 2/28) but for all years 1995 - 2005. Is that possible or am I using the wrong command?


0

Response Number 3
Name: smithdk
Date: April 4, 2005 at 19:15:17 Pacific
Reply:

If you want to pull by month regardless of year then use the month (date) in your query. For February the value should be 2.


0

Response Number 4
Name: themick
Date: April 5, 2005 at 10:30:55 Pacific
Reply:

I have tried using that in several ways: ( =DateSerial(Month(2)); =(Month(2)), etc. but i must not be using the right syntax. Can you fill me in on what the proper statement would be for all February dates (Month(2)) for all years please. Thanks!


0

Response Number 5
Name: smithdk
Date: April 5, 2005 at 15:38:17 Pacific
Reply:

In the query in the field section put month (date) in the field section. In the criteria section you can put 2 (for february). If you want to select the month on the form then instead in the criteria seciton put [forms]![form name]![control name]. The form name is of course the name of the form and the control name is the name of the control that stores the month value. Keep in mind the control name has to store number values related to the month. You can set up a separate table for this and then have a combo box on the form display the month and hide the first column (numbers) so all you do is select the month and the number value is stored in the combo box. The query would look at the combo box to get the month value.



0

Related Posts

See More



Response Number 6
Name: themick
Date: April 13, 2005 at 14:21:40 Pacific
Reply:

Thanks Dave, that works great. Mike


0

Response Number 7
Name: smithdk
Date: April 13, 2005 at 19:45:29 Pacific
Reply:

Glad it worked out.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Access Query BETWEEN statement

Access Query www.computing.net/answers/office/access-query/9548.html

MS Access Querying.. www.computing.net/answers/office/ms-access-querying/1742.html

Access Calculation www.computing.net/answers/office/access-calculation/2737.html