Link to home
Start Free TrialLog in
Avatar of timamartin
timamartinFlag for United States of America

asked on

Access 2007 query between two dates

This is the first time I have ever tried to query for something other than an exact value found in a table. I simply have 4 fields  Name, Hours, StartDate, EndDate. I would like to be able to enter any of the following criteria and return records matching the criteria. My difficulty is that I don't know what to do for the dates. Do I need a table that will store these four values? Can I create a temporary variable? Where do I specify the search criteria? Query? Function?

Thanks in advance!
Avatar of MWGainesJR
MWGainesJR
Flag of United States of America image

Whats the criteria?
are the 4 fields in the same table?
Avatar of timamartin

ASKER

The original table has 10 fields I created a new table to store the user inputs that has 4+1 fields.
what are you wanting to query?
I would like to search for all records between date "A" and date "B" as well as optionally name and hours.
select name, hours from table where startdate >= date and enddate<= date
startdate >= date and enddate<= date

So where do the values stardate and enddate get stored prior to passing them to a query?
cdate is a function will help you build a date from string and the you can compare dates with it
try it
ASKER CERTIFIED SOLUTION
Avatar of MWGainesJR
MWGainesJR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ohhhhhh...I see. Thanks for your assistance that is what I need.