C0L0mb0
C0L0mb0

Reputation: 39

Error appears, when event On Current is triggered

When I reference to subform error occurs. I have 1 main form and 2 subforms on the main one. One of subform has On Current event which trigger code:

 Me.Parent![1ChildEquipFilter].Form.RecordSource = StrSQL 

(it changes second subform's RecordSource)

When the main form is opened the first time, the error message appears 'you entered an expression that has an invalid reference to the property form/report'. But when I click on the debug and then reset, all work properly. What's the matter?

Upvotes: 0

Views: 71

Answers (1)

Gustav
Gustav

Reputation: 55831

When you open the form, first the two subforms are opened, then the main form, and then the two subforms again.

The simple workaround is to eat the error:

On Error Resume Next
Me.Parent![1ChildEquipFilter].Form.RecordSource = StrSQL 
On Error GoTo 0

Upvotes: 1

Related Questions