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!

Setting RecordSource property of a subform.

Status
Not open for further replies.

Sanibel

Technical User
Nov 15, 2001
73
GB
I am trying to set the RecordSource property of a subform in order to display the results of a query.
My code is similar to

Dim strSQL as String
strSQL = "Select statement"
Forms!Main_Form!Sub_Form.RecordSource = strSQL

When the form executes I get the error message
"Object doesn't support this property or method" on the Forms line.

I have chnaged the Forms line to be ...!.RecordSource = ...
both give the same error message.

Any thoughts on how I can make this code work?

Thanks
 
Try if code is on the Main Form:

Me!Sub_Form.Form.RecordSource = strSQL

This if code is on the Sub Form:

Me.RecordSource = strSQL

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top