limit output of query to the last 7 days

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

Guest

I want to build a query that will limit the query to return orders with dates
that fall within the last 7 days. This would then be used to generate a
weekly report automatically. I have checked the help files but I can't seem
to find anything that is this specific.
Thanks in advance.
MarySue
 
try adding the following criteria to your query's date field, as
=Date()-7

that will give you orders with today's date, plus the 7 calendar days prior
to today. to get today's date, plus the last 6 calendar days (total of 7
days), use
Date()-7
or

=Date()-6

hth
 
MarySue said:
I want to build a query that will limit the query to return orders with dates
that fall within the last 7 days. This would then be used to generate a
weekly report automatically. I have checked the help files but I can't seem
to find anything that is this specific.
Thanks in advance.
MarySue

Tina-
Perfect solution!!!!!
Happy Holidays!!
MarySue
 
MarySue said:
Tina-
Perfect solution!!!!!
Happy Holidays!!
MarySue


Tina,
This worked for awhile, so I know the code is good. However, today I when
the ran the query I got the following "compile error":
'((([OrderArchive].FileDate)>=Date()-7))'

Where OrderArchive is the Table and FileDate is the field in the table.

I changed the code to every configuration from above, but I continue to get
this error. Can you give me any guidance?
 
MarySue said:
Tina-
Perfect solution!!!!!
Happy Holidays!!
MarySue

Tina,
This worked for awhile, so I know the code is good. However, today I when
the ran the query I got the following "compile error":
'((([OrderArchive].FileDate)>=Date()-7))'

Where OrderArchive is the Table and FileDate is the field in the table.

I changed the code to every configuration from above, but I continue to get
this error. Can you give me any guidance?

If you are getting a compile error, you probably have a missing
reference.

Open any module in Design view (or click Ctrl + G).
On the Tools menu, click References.
Click to clear the check box for the type library or object library
marked as "Missing:."

An alternative to removing the reference is to restore the referenced
file to the path specified in the References dialog box. If the
referenced file is in a new location, clear the "Missing:" reference
and create a new reference to the file in its new folder.

See Microsoft KnowledgeBase articles:
283115 'ACC2002: References That You Must Set When You Work with
Microsoft Access'
Or for Access 97:
175484 'References to Set When Working With Microsoft Access' for
the correct ones needed,
and
160870 'VBA Functions Break in Database with Missing References' for
how to reset a missing one.

For even more information, see
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html
 
Back
Top