What have I done? You can't open a subform when it is also open in Design view

JMac

New member
Local time
Tomorrow, 00:12
Joined
May 9, 2006
Messages
6
Problem:
Visual Basic run-time error 7792: You can't open a subform when it is also open in Design view.


I have a subform with properties for SourceObject, LinkMasterFields, LinkChildFields changing according to objects and events in the master form.

The subform was bound to a query before which meant that the subform load event was happening as soon as the master form is loaded. I needed to restrict the subform loading until a certain point so I removed the SourceObject property for the masterform's subform. The subform on the master form is now Unbound.

(This is because I'm now running some code on the FormLoad event for the subform which needs to be restricted until the LinkMasterFields and LinkChild Fields properties have been assigned correctly otherwise it takes ages to load.)

Now I'm getting the above error. Obviously, i do not have the subform open anywhere in design view. No Visual Basic windows are open. I've closed the db, closed access, reopened it and clicked on nothing except the masterform. The error occurs when I raise the event in the master form which assigns the sourceobject property to the subform, i.e.

Me.sfmQryAllOV.SourceObject = "sfmQryAllOV"

Can anyone help me? I've googled this but finding no answers.
 
Appears you are using the same sfmQryAllOV as the main form and the subform
 

Users who are viewing this thread

Back
Top Bottom