Microsoft Access - Access database query - Asked By Thanquil Treestrider on 21-Nov-13 04:23 AM

I want to query an Access database between to dates and have it total sales just between those dates.  Can anyone help please.
Pat Hartman replied to Thanquil Treestrider on 30-Oct-14 02:17 PM

I'm sorry this question has gone unanswered for a year.


The best way to create queries if you don't have a working knowledge of the SQL syntax is by using the QBE. 

  1. Open the query designer and select 1 or more tables and/or queries to include in the query you are building. 
  2. Close the select dialog.
  3. If you have selected multiple tables/queries draw the appropriate join lines to connect each data source.
  4. Select the columns you want from each data source.
  5. To make a totals query, press the big sigma button.  This adds a totals line and "Group By" as the action for each column.  Change the total cell to Sum or Avg or whatever other aggregation you want.

Selection criteria is most useful when it is not hard-coded so in this case, I would add two controls and a button to a form.  The controls would be used to hold the start and end dates and the button would be used to run the report.


Back to the query.

In the Criteria cell for the SaleDate enter an expression like:

Between Forms!yourform!FromDT AND Forms!yourform!ThruDT


Newer versions of Access have intellisense and will help you with the reference to the form fields.  Final step is to uncheck the show box for the SaleDate since that will interfere with the aggregation.