Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using Variables in Reports

0 views
Skip to first unread message

GG

unread,
Jun 21, 2000, 3:00:00 AM6/21/00
to
I used a variable with the DoCmd.OpenReport Variable Name etc.
It worked fine. Then I tried to use the same variable on the next line
referencing the report ie: variablereportname.FilterOn = True
I got errors that I think mean that it doesn't recognise the variable name
as a the reportname that it is.
Also when I used a variable in place of the criteria in the where condition
of the open report it didn't recognise it. When I placed an actual criteria
in place it filtered as it should.
I expected that I could use a string variable in place of actual criteria.
Why can't I.
What I'm really trying to do is have 2 fields to filter on without a filter
query?
Can I do it?
Finding all the referencing difficult.
thanks,
Carol


Grant Geddes
Sutton Group S.W.
http://www.ggeddes.com
ged...@ggeddes.com

Dirk Goldgar

unread,
Jun 21, 2000, 3:00:00 AM6/21/00
to
This works:

Dim stDocName As String
Dim stCriteria As String

stDocName = "rptPeople"
stCriteria = "ID=" & Me!ID

DoCmd.OpenReport stDocName, acPreview
Reports(stDocName).Filter = stCriteria
Reports(stDocName).FilterOn = True

As does this:

DoCmd.OpenReport stDocName, acPreview, , stCriteria

--

Dirk Goldgar
(remove NOSPAM from reply address)

"GG" <ged...@ggeddes.com> wrote in message
news:iQ745.18734$ef6.2...@news1.rdc1.ab.home.com...

0 new messages