A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I filter an Access report?



 
 
Thread Tools Display Modes
  #1  
Old January 15th, 2010, 06:53 PM posted to microsoft.public.access.reports
Meshman
external usenet poster
 
Posts: 4
Default How do I filter an Access report?

How do I apply a filter to an Access report? I seriously cannot find any
examples anywhere. Well, MS says this works:

#2/2/2006# and #2/4/2006#


.... but all I get is "missing operator". It then strikes me I haven't told
it what to filter on. What's the syntax for it? I have a table called
"Inventory Transactions" and need the field "Transaction Date" filtered by
the above criteria (different date range but the above example will do).

I tried this:

[Inventory Transactions].[Transaction Date]=#1/1/2009# And [Inventory
Transactions].[Transaction Date]=#12/31/2009#

....but all it does is prompt me for a value. - ?

Any ideas?
Thanks!
  #2  
Old January 15th, 2010, 07:24 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default How do I filter an Access report?

You can filter a report by filtering the query the report is based on. What
value are you getting prompted for?

I typically open a report with code using the DoCmd.OpenReport method. You
can add a WHERE CONDITION to this.
Dim strWhere as String
strWhere = "[Transaction Date] Between #1/1/2009# And #12/31/2009#"
DoCmd.OpenReport "rptMyReportName", acPrintPreview , , strWhere


--
Duane Hookom
Microsoft Access MVP


"Meshman" wrote:

How do I apply a filter to an Access report? I seriously cannot find any
examples anywhere. Well, MS says this works:

#2/2/2006# and #2/4/2006#


... but all I get is "missing operator". It then strikes me I haven't told
it what to filter on. What's the syntax for it? I have a table called
"Inventory Transactions" and need the field "Transaction Date" filtered by
the above criteria (different date range but the above example will do).

I tried this:

[Inventory Transactions].[Transaction Date]=#1/1/2009# And [Inventory
Transactions].[Transaction Date]=#12/31/2009#

...but all it does is prompt me for a value. - ?

Any ideas?
Thanks!

  #3  
Old January 15th, 2010, 07:30 PM posted to microsoft.public.access.reports
Steve[_77_]
external usenet poster
 
Posts: 1,017
Default How do I filter an Access report?

Create a query based on your table called "Inventory Transactions" and
include all the fields including "Transaction Date" that you want to show in
the report. Set the criteria for "Transaction Date" to:
Between #2/2/2006# And #2/4/2006#

Probably you want to set the dates on the form from which you open the
report and then set the criteria to:
Between Forms!FormName!StartDate And Forms!FormName!EndDate

Or you could do this:
Between [Enter Start Date] And [Enter End Date]
and two dialogs will appear asking for the Start Date and End Date.

Steve




"Meshman" wrote in message
...
How do I apply a filter to an Access report? I seriously cannot find any
examples anywhere. Well, MS says this works:

#2/2/2006# and #2/4/2006#


... but all I get is "missing operator". It then strikes me I haven't
told
it what to filter on. What's the syntax for it? I have a table called
"Inventory Transactions" and need the field "Transaction Date" filtered by
the above criteria (different date range but the above example will do).

I tried this:

[Inventory Transactions].[Transaction Date]=#1/1/2009# And [Inventory
Transactions].[Transaction Date]=#12/31/2009#

...but all it does is prompt me for a value. - ?

Any ideas?
Thanks!



  #4  
Old January 15th, 2010, 08:16 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default How do I filter an Access report?

Meshman wrote:

How do I apply a filter to an Access report? I seriously cannot find any
examples anywhere. Well, MS says this works:

#2/2/2006# and #2/4/2006#


... but all I get is "missing operator". It then strikes me I haven't told
it what to filter on. What's the syntax for it? I have a table called
"Inventory Transactions" and need the field "Transaction Date" filtered by
the above criteria (different date range but the above example will do).

I tried this:

[Inventory Transactions].[Transaction Date]=#1/1/2009# And [Inventory
Transactions].[Transaction Date]=#12/31/2009#

...but all it does is prompt me for a value. - ?



I think you put that filter criteria in the wrong place, but
you did not say where/how you are trying to use that
criteria.

When you are prompted for sumething, it means that the thing
you are prompted for is not in the report's record source
table/query (a typo?)

--
Marsh
MVP [MS Access]
  #5  
Old January 15th, 2010, 08:29 PM posted to microsoft.public.access.reports
Meshman
external usenet poster
 
Posts: 4
Default How do I filter an Access report?

Apparently, this is the answer:

"[Inventory Transactions].[Transaction Date] = #" & 1/1/2009 & "#" & " And
[Inventory
Transactions].[Transaction Date] = # " & 12/31/2009 & "#"

....and it doesn't work either but it doesn't return any errors. The report
contains ALL records, even with this criteria. I had to go into the
recordsource and add the criteria in there.


"Meshman" wrote:

How do I apply a filter to an Access report? I seriously cannot find any
examples anywhere. Well, MS says this works:

#2/2/2006# and #2/4/2006#


... but all I get is "missing operator". It then strikes me I haven't told
it what to filter on. What's the syntax for it? I have a table called
"Inventory Transactions" and need the field "Transaction Date" filtered by
the above criteria (different date range but the above example will do).

I tried this:

[Inventory Transactions].[Transaction Date]=#1/1/2009# And [Inventory
Transactions].[Transaction Date]=#12/31/2009#

...but all it does is prompt me for a value. - ?

Any ideas?
Thanks!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:37 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.