Dates in a query

S

SJL

Hi
I have a database detailing start date and end dates of temporary staff. My
question is how do I set up a query that will show how may temp staff I have
at any given date. e.g. If I wanted to find out how many temp staff I had on
staff right now?

Thanks
 
D

Douglas J. Steele

Your Where clause would be something like

WHERE StartDate <= Date()
AND Nz(EndDate, Date()) >= Date()
 
S

SJL

Hi Douglas
Thanks for your prompt response. Where do I put the where clause in though?
This is where I show my ignorance... is it in design view of query?

Stu
 
D

Douglas J. Steele

You can work directly with the SQL generated by Access, or you can work with
the graphical query builder.

If you choose the latter, ensure that StartDate and EndDate are both in the
grid. In an empty cell on the Field row, put Nz([EndDate], Date()), and
uncheck the Show box underneath it.

As the criteria under StartDate, put <= Date().

As the criteria under Nz([EndDate], Date()), put >= Date()
 
S

SJL

Excellent. Thanks.

Stu

Douglas J. Steele said:
You can work directly with the SQL generated by Access, or you can work with
the graphical query builder.

If you choose the latter, ensure that StartDate and EndDate are both in the
grid. In an empty cell on the Field row, put Nz([EndDate], Date()), and
uncheck the Show box underneath it.

As the criteria under StartDate, put <= Date().

As the criteria under Nz([EndDate], Date()), put >= Date()


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


SJL said:
Hi Douglas
Thanks for your prompt response. Where do I put the where clause in
though?
This is where I show my ignorance... is it in design view of query?

Stu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top