Building criteria ...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I create criteria that will select, for instance, a time
period...between the first of a month and the end of a month. i.e. I want to
select all sales that were final during the month of October....
 
How do I create criteria that will select, for instance, a time
period...between the first of a month and the end of a month. i.e. I want to
select all sales that were final during the month of October....

Two ways:

1. Put a calculated field in the Query by typing

SaleMonth: Month([SaleDate])

in a vacant Field cell, with a criterion of

[Enter month number:]

Typing 10 in that prompt will return all October sales (in *any year*
so you may want a Year([SaleDate]) criterion as well).

2. As a criterion under SaleDate type
= DateSerial(Year(Date()), [Enter month number:], 1) AND < DateSerial(Year(Date()), [Enter month number:] - 1, 1)

This can be made a bit fancier to allow you to search across years
(e.g. running the search in January to look for December sales won't
work).

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top