Mike-

You said you have 10 possible queries, but you list just one.  What are the
other queries, and how will the user select which "report type" to print?

Let's say you have a form with an Option group that allows the user to pick
the report type.  The form also has a command button to run the report.
First, you need a public variable.  In a Standard module (one you can see in
the list in the Database window), put this in the Declarations section:

Public gstrReportQuery As String

In the Click event of the command button, do somethin like:

  Select Case Me.optReportType
    ' Option 1
    Case 1
      gstrReportQuery = "qry_WOsummaryByDate_EnteredBy"
      DoCmd.OpenReport "rptWOSummary", acViewPreview
    ' Option 2
    Case 2
      gstrReportQuery = " <name of query for 2nd option> "
      DoCmd.OpenReport "rptWOSummary", acViewPreview
    ' .. and other cases as needed
  End Select

In the Open event of the report:

   Me.RecordSource = gstrReportQuery


John Viescas, author
"Building Microsoft Access Applications"
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Mike Bisson
Sent: Monday, January 23, 2006 3:05 PM
To: [email protected]
Subject: RE: [ms_access] Changing a reports record source

Thanks John,

Can you provide a little help on the code?  My query name will be:
qry_WOsummaryByDate_EnteredBy

Thanks :)

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of John Viescas
Sent: Monday, January 23, 2006 2:46 PM
To: [email protected]
Subject: RE: [ms_access] Changing a reports record source


Mike-

You can change the RecordSource property in the Open event of the report.
Perhaps set a public variable with the SQL or name of the query you want to
use and have the code in the Open event pick it up from that.

John Viescas, author
"Building Microsoft Access Applications"
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Mike Bisson
Sent: Monday, January 23, 2006 12:35 PM
To: [email protected]
Subject: [ms_access] Changing a reports record source

Hi All,

I have a basic report template that I want to use.  How can I modify each
version of the report to use a different record source (query)?  I don't
want to have to recreate the same report 10 times.

Thanks :)

==================================
Mike Bisson
Manager of IT & Logistics
Carthuplas, Inc.
V: 207-985-4972 x658  F: 207-985-2105
[EMAIL PROTECTED]  http://www.carthuplas.com



 
Yahoo! Groups Links



 






 
Yahoo! Groups Links



 




 
Yahoo! Groups Links



 






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to