Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2005
    Posts
    113

    Unanswered: Swich subforms in a main form

    I have a main form and would like to swich between two differente subforms depending on a choise made by the user in a combobox but I dont know how.

  2. #2
    Join Date
    Apr 2004
    Posts
    173
    Not sure exactly what you mean here, but couldn't you hide one or show one based on the selection in the combo box using the visible property of the subform. This is of course if you mean a main form with either one or the other subform in it. Sorry if this is not at all what you meant.

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    What you can do is make a blank subform (i.e. no sourceobect) on your main form and then set the SourceObject of the subform to the form you want depending on the choice made in the combobox. This works very well and will also make your main form load quicker since it doesn't have a bound subform when it first loads. Alternatively, you could also use a tab control but this wouldn't work as well as both sub forms would load.

    ex:
    Private Sub combobox_AfterUpdate()
    Me.suubformx.sourceojbect = "MySubFormName"
    End Sub
    Last edited by pkstormy; 11-23-06 at 05:45.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Nov 2005
    Posts
    113
    Thanks Paul. It works greate.

  5. #5
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Glad it worked. Thanks for letting me know.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •