Changing RecordSource of a second subform

floydman

Registered User.
Local time
Today, 05:43
Joined
Aug 29, 2007
Messages
16
I have a mainform with 2 unbound subforms, when a new record is selected on subform1 I want to move focus and change the recordsource of subform2 and requery.

In the Current Event of sub1 I have:

Me.Parent!sub2.Form.RecordSource = strSQL
Me.Parent!sub2.Form.SetFocus
Me.Parent!sub2.Form.Requery


I was getting a message saying object closed or doesn't exist but I am now getting a you cancelled the previous operation error.

Can anyone point me on the right direction to control this second subform from the first ?

Cheers
 
do the requery before the setfocus, i think

instead of Me.Parent!sub2.Form.Requery

try parent!subdetails2.requery (ie - whatever the subforms name is on the parent form)
 
Oh, forgot to add that the error is on

Me.Parent!sub2.Form.RecordSource = strSQL
 
with a form it might be

.sourceobject, rather than recordsource

or it might be the syntax you are using to address the subform

--------
not sure, and I haven't got time to try it at the moment, sorry
 

Users who are viewing this thread

Back
Top Bottom