Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query to pull data by month seperately, any ideas?

Status
Not open for further replies.
Jun 16, 2005
29
0
0
US
I'd like to create a query which pulls data based on a selection made from a pull down list on my main form. Ideally, if I click the list and select July 05, it'll pull only the records entered for July. How could I build the query when all records are dated 00/00/0000?

Thanks to all in advance!!!
 


Hi,

If you have a Date field that you need to compare to you could select where the data field is BETWEEN the first of the month and the last of the month
Code:
...
where MydateField Between dateserial(year,month,1) and dateserial(year,month+1,1)-1
where you would supply year and month from the selection.

Skip,
[sub]
[glasses] [red]Be advised:[/red]We know Newton's 3 Laws. But did you hear about the [red]FOURTH???[/red]
Only ONE fig per cookie![tongue][/sub]
 
Hi Skip, You must really know your stuff. I see you offer help to lots of requests out there. I do appreciate your reply, however, I'm a little unsure as to where or how I enter the code into the query in order to get the data I need. I pretty much do all of my db form, query, macro building with the applied utilities within Access. I really don't do any programming. Is it possible to just apply that code by viewing the code and pasting it? Thanks again I appreciate your help.
 
I figured it out, yey me. Between #1/1/05# and #1/21/05# in the criteria of the query
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top