Using dates in query

C

cornish

I have an employee data base which has as one field the date the employee
finished employment. I need my query to select only employees that are
currently employed (in which case the field will be blank), or have only
finished employment in the last week or so. In other words the query will
exclude employees that have finished before a particular date (which varies
from week to week). I want to be able to vary the date at least once a week
for report purposes, but also more often as required. Any suggestions will
be appreciated.

--
Doug McKean
Office Manager
R J Cornish & Co Pty Ltd
www.rjcornish.com
Phone (03) 5872 2055
 
L

Les

You could set up your query to accept a date parameter.
You would be prompted to enter a date and could select all
employees with finished date less than or equal to that
date.

Or if you don't want to enter a date, you could build an
expression. You could use the DATEADD function, along
with DATE() function, to subtract a number of days/weeks
from today's date.

Hope this helps.
 
V

Van T. Dinh

In the Column / Field for finished date, enter the criteria:
[Enter Finish Date:] OR Is Null

The first condition selects employees that finished after the date entered
and the second condition selects current employees.

--
HTH
Van T. Dinh
MVP (Access)
 
D

David Mitchell

Doug,

In the query you are using add the following two lines as criteria
under the field containing the date left..

Is Null

[tblname]![fldname] < [Enter Date]

tblname is the name of your table and fldname is the name of the date
field relating to when the employee left.

When you run the query you get prompted for [Enter Date], enter the
date you want. You will then get a list of employees who have not
left (is null) and those who left before the date you entered.

Hope this Helps

David A Mitchell
Share What You Know, Learn What You Don't
 
G

Guest

Try creating a parameter query. I would suggest the
following syntax:
=[Enter Date]

For the query for current employees, you are trying to
pull from a blank field correct? If that is so, I would
use the criteria to be Is Null.

When you open the query/report it will prompt you each
time to enter a date.
 

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

Similar Threads


Top