Changing subform and linking dynamically with VBA

D

Doug

I have a Access 2002 form that contains a subform that resides on a tab object.

Based on a condition, I want to change the subform to another form and set
the linking in the form_open event.

I am struggling to get the syntax correct. The code I am using is as follows:
If cnstCustom = "XXX" Then
Me.TabCtl26.Pages("CPT Overrides").Controls("frmDecoy").SourceObject
= "frmCPTOverrides"
Me.TabCtl26.Pages("CPT
Overrides").Controls("frmDecoy").LinkMasterFields = "CompanyCode"
Me.TabCtl26.Pages("CPT
Overrides").Controls("frmDecoy").LinkChildFields = "CompanyCode"
Me.TabCtl26.Pages("CPT Overrides").Visible = True
End If

It blows up when I try to set the linkmasterfields telling me that setting
that I entered for this property is not valid.

Does anyone have a suggestion?

Thanks,
Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top