Query to get data out of one or more fields

  • Thread starter Thread starter maemae2
  • Start date Start date
M

maemae2

I have a database that tracks when I make site visits to various job sites.
At times one site may require multiple visits. I have one table, with Job
Site Name (column) and dates when the various trips were made (date column).
Job Site Name " A" was visited 3 times Job Site B 2 times, Job Sites C, D
and E were visited 2, 3 and 1- all at different dates. How do I make a
query that asks how many times I visited a trip during the month of say
August?
 
So you have a table of sites, with a SiteID primary key.

Then you have a table of visits, with fields like this:
- VisitID AutoNumber primary key
- SiteID Number which site was visited.
- VisitDate Date/Time when the visit took place.

To create the query:
1. Create a query that uses both tables.

2. Depress the Total button on the toolbar.
Access adds a Total row to the query design grid.

3. Drag SiteID into the grid.
Accept Group By under this field.

4. Drag VisitID into the grid.
Choose Count under this field.

5. Drag VisitDate into the grid.
Choose Where under this field.
In the Criteria row, enter:
Between #8/1/2008# And #8/31/2008#

This will give you the count of visits, per site, during August.
 
Back
Top