Changing subform "Source Object" property with VBA

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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
 
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
 
Back
Top