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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the Record Source of a subform 1

Status
Not open for further replies.

Brambojr

Technical User
Oct 26, 2000
73
US
I am having a bit of difficulty with the last part of a project I am on. I have a form with a subform at the bottom.

Based on the selections from a set of combo boxes across the top, my form will assemble an SQL statement. I need to pass this into the subform and refresh/requery it, but how???

In the ideal world I would love to have this SQL also be the RecordSource for a report, so that we can have dynamic reports.

If I publicly declare the variable strSQL(etc) in the parent form will that make the RecordSource available to the report?

P.S. They can leave the combo boxes empty and the form will still generate the correct SQL. Brambojr
 
It doesn't even have to be public. If you have any string variable on your parent form, you can assign it to the Record Source of your subform.

Assuming you have a string variable (strSQL) that has already been populated with a string.

From the parent form, the syntax would be:

Me.SubformName.Form.RecordSource = strSQL
Me.SubformName.Form.Requery Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top