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  

Problem with filtering report



 
 
Thread Tools Display Modes
  #1  
Old May 24th, 2004, 07:42 PM
Sunny
external usenet poster
 
Posts: n/a
Default Problem with filtering report

On user interface form I am asking transaction date range, and I would like
to set these dates as filter condition on filter property of report.
In open event of Report following code works fine.

Me.Filter = "TrxDate BETWEEN #" & Forms("Rpt1").txtStartDate & "# AND #" &
Forms("Rpt1").txtEndDate & "#"

but
"TrxDate BETWEEN #" & Forms("Rpt1").txtStartDate & "# AND #" &
Forms("Rpt1").txtEndDate & "#"
on Filter property of report doesnt work. It gives me error, runtime error
'3075', "Invalid use of '.', '!', or '()' in query expression.

Can anyone help meto find out what am i missing?

Note: I dont want to use filter on open event becuase this report can be
used as sub report.

Thanks.


  #2  
Old May 24th, 2004, 08:05 PM
Larry Linson
external usenet poster
 
Posts: n/a
Default Problem with filtering report

Looks to me as if you already found your own solution --
set the Filter from the Open event. There are limitations
to the expressions acceptable in a property that do not
apply to code... when you use the code, you have
substituted the values of the date controls before
inserting it into the Filter.

As for me, I'd rather create the entire SQL statement and
replace the RecordSource. It can be significantly more
efficient to let the database engine select only the
needed records, than to bring them all and then filter.

Larry Linson
Microsoft Access MVP

-----Original Message-----
On user interface form I am asking transaction date

range, and I would like
to set these dates as filter condition on filter property

of report.
In open event of Report following code works fine.

Me.Filter = "TrxDate BETWEEN #" & Forms

("Rpt1").txtStartDate & "# AND #" &
Forms("Rpt1").txtEndDate & "#"

but
"TrxDate BETWEEN #" & Forms("Rpt1").txtStartDate & "#

AND #" &
Forms("Rpt1").txtEndDate & "#"
on Filter property of report doesnt work. It gives me

error, runtime error
'3075', "Invalid use of '.', '!', or '()' in query

expression.

Can anyone help meto find out what am i missing?

Note: I dont want to use filter on open event becuase

this report can be
used as sub report.

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:45 PM.


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