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 strongm 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
 
All you need to do is put the following line in the load event of the form to be opened

me.recordsource = "qryQueryName"

You can always call a dialogue to allow the user to choose the query before you set the record source.

 
Hi,
The form that I open has 3 radio buttons(for test)
view by workOrderNumber
view by Candidate
view by Sales REP
after the choice is made, a parm query should run asking for a particular sales rep or...
then the report will be generated.
Thanks..Russ
 
Hi Joao,
I tried that and it went straight into the report and didn't stop for the parameter query. The report was empty.
Russ
 
Hi,
The query works fine outside of the report. The where clause is built in to the query not in the code. It looks like this:

SELECT Presentation.*
FROM Presentation
WHERE (((Presentation.Submittal)Like"*"&[Type a candidate:]&"*"));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top