Dependent forms

G

Gabe

How do I make a different form appear when a certain value from a combo box
is selected?

For example, if I'm in "Form1" and I select the value "type2" from a combo
box, then "Form1" will dissapear and you will now see "Form2". I'm using
access 2003.

Thanks,
~Gabe
 
J

John W. Vinson

How do I make a different form appear when a certain value from a combo box
is selected?

For example, if I'm in "Form1" and I select the value "type2" from a combo
box, then "Form1" will dissapear and you will now see "Form2". I'm using
access 2003.

Thanks,
~Gabe

Use the AfterUpdate event of the combo box. What's the rowsource of the combo?
How can Access tell from the user's selection which form to open? Could you
perhaps include a field in the combo's rowsource containing the formname? You
would use code like

DoCmd.OpenForm acForm, Me!combobox.Column(x)
DoCmd.Close acForm, Me.Name

to open the form selected and close the current one.
 
G

Gabe

The row source is currently: type1; type2; type3. So if I rename the form
itself to "type2" so that it will be the same as what is in the row source
like you suggested below, what would that look like in the after update combo
box? I'm not sure how to write it in VBA for Access, can you help?

Thanks,
~Gabe
 
J

John W. Vinson

The row source is currently: type1; type2; type3. So if I rename the form
itself to "type2" so that it will be the same as what is in the row source
like you suggested below, what would that look like in the after update combo
box? I'm not sure how to write it in VBA for Access, can you help?

If you wish, you could change the combo's Column Count property to 2, its
ColumnWidths to 0.5";0" (to conceal the second column), its Bound Column to 2,
and its RowSource to

"Type1";"frmForm1";"Type2";"frmForm2";"Type3";"SomeOtherFormName"

This will display the type name to the user (probably more meaningful than a
form name) but return the actual form name.

The code would be as I posted in the previous message.
 

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