Changing subform "Source Object" property with VBA

G

Guest

I want to open/activate a different subform based on the value of a combo box
in the main form. Can anyone tell me how to change the source object property
of a subform to achieve this using VBA code?
 
S

Steve Schapel

Fourstroke,

Something like this, on the After Update event of the combobox...

Private Sub YourCombobox_AfterUpdate()
Select Case Me.YourCombobox
Case "FirstOption"
Me.YourSubform.SourceObject = "fred"
Case "SecondOption"
Me.YourSubform.SourceObject = "wilma"
End Select
End Sub
 
G

Guest

Hello Mr. Schapel,
I have a problem with this. Setting the sourceobject via VBA generates the
error message "You don't have permission to insert this form into another
form" when the User is one who has no "Modify Design" or "Administrer"
permissions. It works fine, though, when the VBA code is run by an
Administrator.

Is this normal? If so, is there another way to allow such a user to run VBA
code that changes the subform?

Thanks

ROBBIE
 

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