Click here to Skip to main content
15,851,242 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Okay, I know how to do this but it's just plain not working. I swear I've done this before. No matter how I vary the code I keep getting "you entered an expression that has an invalid reference to the property Form/Report"

I'm trying to set the RecordSource of one subform during the OnCurrent event of another subform on the SAME main form.

Main form: frmMain
Subform1: frmSub1 (in this form's OnCurrent event)
Subform2: frmSub2 (setting the source for this one)

in frmSub1's OnCurrent event:
Me.Parent!frmSub2.Form.RecordSource = "blah blah blah..."
Forms!frmMain!frmSub2.Form.RecordSource = "blah blah blah..."

If I do this in debug window:

I get the result I expect. But if I do this in the debug window:

I get the error noted above. Of course the error has nothing to do with the SQL string that I'm using to set the RecordSource. The error is saying it just plain doesn't like my form references. My eyes are starting to go nuts on this one. Can anyone see where the problem is?

Note that these subforms are NOT nested. They are separate subforms side by side on the same main form.

Updated 16-Oct-12 9:40am
Maciej Los 16-Oct-12 14:35pm    
Not clear. Please, be more specific...

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900