Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SET RECORDSOURCE AT RUN TIME

Status
Not open for further replies.

rry2k

Programmer
Jun 28, 2001
678
US
Hi,
I'm opening a report from a radio button using a DoCmd.OpenReport "presentation", acViewPreview.
I need to provide an option for different queries based on the users choice. Is there a way to change the recordsource property in code? My report is obviously named presentation.

Thanks..Russ
 
There are probably Easier ways to do this, but I would set an "On Open" event in the Report, so that when the report loads it runs a piece of code, to set the recordsource.
If you need to set it when starting the report, then do something like.

-----
Global recSrc as String

recSrc = "Wheatever Recorsource you need"
DoCmd.OpenReport "Presentation",acViewPreview
-----

And in the code of the report you would do something like:

Private Sub Report_Open(Cancel As Integer)
Report.RecordSource = recSrc
End Sub
Eldaria

That was my 25cent** of opinion.

** Inclusive Intrest, tax on interest, Genral tax, Enviromental tax, Tax, and tax on intrest, tax on fees, tax on tax, and other Various taxes and fees.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top