Open SubForm based on ComboBox selection

G

Guest

Greetings
My Platform is Access 2000

I have a Parent Form that has 3 SubForms (Form1, Form2, Form3) set at
Visible = NO. (Not visible on Parent Form)
I then have a ComboBox with 3 lookup fields (Field1, Field2, Field3) in the
Parent Form.

What I am NOT able to code is the following:
When selecting "Field1" in ComboBox; "Form1" must be set to Visible = True
When selecting "Field2" in ComboBox; "Form2" must be set to Visible = True
When selecting "Field3" in ComboBox; "Form3" must be set to Visible = True
Is this at all possible?? , and if so, I would greatly appreciate a sample
code
 
M

Marshall Barton

Claude said:
My Platform is Access 2000

I have a Parent Form that has 3 SubForms (Form1, Form2, Form3) set at
Visible = NO. (Not visible on Parent Form)
I then have a ComboBox with 3 lookup fields (Field1, Field2, Field3) in the
Parent Form.

What I am NOT able to code is the following:
When selecting "Field1" in ComboBox; "Form1" must be set to Visible = True
When selecting "Field2" in ComboBox; "Form2" must be set to Visible = True
When selecting "Field3" in ComboBox; "Form3" must be set to Visible = True
Is this at all possible?? , and if so, I would greatly appreciate a sample
code

Note that the code below uses FormX as the name of the
subform **control** on the main form, which may or may not
be the same as the name of the form object they are
displaying.

Select Case Me.combobox
Case "Field1"
Me.Form1.Visible = True
Me.Form2.Visible = False
Me.Form3.Visible = False
Case "Field2"
Me.Form2.Visible = True
Me.Form1.Visible = False
Me.Form3.Visible = False
Case "Field3"
Me.Form3.Visible = True
Me.Form1.Visible = False
Me.Form2.Visible = False
End Select
 
M

Marshall Barton

Claude said:
My Platform is Access 2000

I have a Parent Form that has 3 SubForms (Form1, Form2, Form3) set at
Visible = NO. (Not visible on Parent Form)
I then have a ComboBox with 3 lookup fields (Field1, Field2, Field3) in the
Parent Form.

What I am NOT able to code is the following:
When selecting "Field1" in ComboBox; "Form1" must be set to Visible = True
When selecting "Field2" in ComboBox; "Form2" must be set to Visible = True
When selecting "Field3" in ComboBox; "Form3" must be set to Visible = True
Is this at all possible?? , and if so, I would greatly appreciate a sample
code


Please keep the correspondence in the newsgroups. Private
consulting is reserved or paying clients.

The code I posted is supposed to be in the combo box's
AfterUpdate event procedure.
 

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