UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> creating different versions of a report with code    
 
   
piggitypow
post Aug 10 2005, 11:13 AM
Post #1

UtterAccess Enthusiast
Posts: 83



On a form, I have several command buttons. Each button opens a preview of a basically the same report, but for different geographic regions. For the time being, I have actually created a separate report for each region by altering the base report's query criteria slightly.

This works, but I would prefer to set the query criteria in the command button code so that only one report needs to be in the database. The report has a field CountyNumber (integer), and I want to set the CountyNumber in the command buttons such that cmdCounty1 opens the report with CountyNumber=1, cmdCounty2 opens the report with CountyNumber=2, etc.

Any tips for the proper code to load the form differentially for the various buttons?
Go to the top of the page
 
+
JayNoelOlimpo
post Aug 10 2005, 11:18 AM
Post #2

UtterAccess VIP
Posts: 7,990
From: Philippines



Hi;

try removing any criteria in the reports recordsource and have this on click event procedure of a command button ...

DoCmd.OpenReport "ReportNameHere", acPreview, , "[CountryNumber]=" & Me![CountryNumber]

in the from :

and you could create some sort of like a combo box to select for a country naming that control as CountryNumber ..

HTH.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 24th May 2013 - 09:39 AM