View Full Version : Change recordsource based on form choice


dapfeifer
07-09-2008, 07:38 AM
Hey everyone,

I'm trying to generate a report that needs to have its record source based on what option (of 2) a user selects. A different query will be called depending on the selection. Any suggestions to help point me in the right direction would be great, because I seem to be running in circles at the moment!

pbaldy
07-09-2008, 08:49 AM
You can put code in the report's open event that tests the form and sets the record source appropriately:

Me.RecordSource = "QueryName"

dapfeifer
07-09-2008, 09:05 AM
Once again you came through for me with enough to get me on track for what I need done. I ended up writing an if statement that varies based on which of the two options is selected, then assigning the corresponding query. Thanks for the help again!