access report changing source name

P

Pendelfin

I wish to change the Query name a Report depends on. Please can someone
explain if it is possible how if I change the query name I can get the report
to look at the new query. The query will still contain the same fields
required for the report.

Many Thanks in advance
 
S

SusanV

Hi Pendelfin,

The easiest way is if the queries contain all the same fields, but different
criteria, set the report to use a query with no specific criteria - SELECT *
FROM Table. Then set the criteria using the where clause when opening the
report: For example, if you want to open it based on the value of a combobox
on a form, put something similar to the below in the OnClick of the button
which opens the report:

DoCmd.OpenReport "YourReport",acViewPreview,,"YourField = '" &
Me.YourComboBox & "'"
 
Top