Access2000: How to create snapshots with filtering

  • Thread starter Thread starter Arvi Laanemets
  • Start date Start date
A

Arvi Laanemets

Hi

In my App, I run a lot of reports from command button. What kind of output
is used (preview, print or snapshot), which report is started, and for which
year data are selected from source table(s), are determined by 3 controls on
form. All this works fine except for snapshots - I didn't find any way to
limit snapshot to data from one year. Here is a snippet from my code:

....
Select Case varRepOutput
Case "Preview"
DoCmd.OpenReport varRepName, acPreview, , "YearNum=" & varRepYear
Case "Print"
DoCmd.OpenReport varRepName, acNormal, , "YearNum=" & varRepYear
Case "Snapshot"
DoCmd.OutputTo acOutputReport, varRepName, acFormatSNP,
varRepDestination
End Select
....
-----------------

I don't like the idea to have a whole set of almost identical report for
every year - and to add every new year a lot of new ones. So maybe someone
has some better solution.
Thanks in advance
 
Arvi,

One approach to this is to base the report on a query, where the Year
data is selected within the criteria of the query itself, by reference
to the control on the form, using syntax such as
[Forms]![NameOfForm]![NameOfYearCriteriaControl]
 
Hi


Steve Schapel said:
Arvi,

One approach to this is to base the report on a query, where the Year
data is selected within the criteria of the query itself, by reference
to the control on the form, using syntax such as
[Forms]![NameOfForm]![NameOfYearCriteriaControl]

Another approach in addition the one I got from Thomas Möller from
microsoft.public.de.access - the one to edit according
CurrentDB.QueryDefs("MyQuery").SQL when the report is called.


Thanks again
 
Hi


Pieter Wijnen said:
Maybe it's me missing something - but how about putting the criteria in the
recordsource(?!?) of the report instead

I got a couple of ideas how to proceed meanwhile. Why I didn't put the
criteria in the recordsource directly - I want the same report to return
reports for fifferent years by selection. I.e. when the active year for
application is set to 2003, then all reports are for year 2003. When the
active year is set to 2000, all reports are for year 2000, etc. And next
year I want the app to report for year 2005 without me redesigning any
reports (except there are changes in report main structure).
 
Arvi Laanemets said:
In my App, I run a lot of reports from command button. What kind of output
is used (preview, print or snapshot), which report is started, and for which
year data are selected from source table(s), are determined by 3 controls on
form. All this works fine except for snapshots - I didn't find any way to
limit snapshot to data from one year. Here is a snippet from my code:

For a page on how to print a report for a single record and how to
generate reports to attach to emails see Emailing reports as
attachments from Microsoft Access at
http://www.granite.ab.ca/access/email/reportsasattachments.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
yes offcourse, but you could still add it as a criteria
ie
SELECT .. FROM ..
WHERE THEYEAR=Year(Now())
or use a control on a form as criterion

Pieter
 
Back
Top