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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2007 - How To Do a Select Query for Range of Dates?

Status
Not open for further replies.

lrdave36

Technical User
Jan 6, 2010
77
US
Hey guys,


I created a label report that runs a query. The query asks the user to enter in a date, and then it pulls all the records with that matching date field.

Now they want the user to be able to put in a beginning date and ending date, and the query retrieve all the records in between those dates.

It sounds easy, but I can't find a way to do this. My SQL view of the query looks like this:

Code:
SELECT Main.title, Main.First_name AS [First], Main.Middle_name, Main.Last_name AS [Last], Main.Address1, Main.Address2, Main.City, Main.State, Main.Zip, Main.Pos_num, Main.Date_receipt

FROM 

Main

WHERE (((Main.Pos_num)=[What is the position number?]) AND ((Main.Date_receipt)=[What is the date? Example - 03/31/2010]));

I want to prompt them for begin date and then end date.


Thanks.
 


Hi,
Code:
WHERE (((Main.Pos_num)=[What is the position number?])  
  AND ((Main.Date_receipt) BETWEEN [What is the date? Example - 03/31/2010] AND [Another Date]));
This is really best done iusing a FORM and not as a parameter in a query, as users will inevitably enter incorrect data, which your query cannot control.


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Can a form link to a report though? I don't think the form route is going to work. They have this database locked down, and I've had to manually do a customize to add in all the toolbar buttons.

The More Forms icon is grayed out so I can't get to the form wizard.
 



Now you're asking questions that will be better addressed in one of the many MS Access forums like forum702 or forum703.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top