Open a form based on combobox selection


G

Guest

Hi,

I have a main form that contains a combobox with several options, I would
like the user to be able to select an option from this combo box and have
another form open automatically based on the user selection. For example
if the the user selects "cars" from combobox then a "CarDataEntry" from
would open, or if the user selects "planes" then the "PlanesDataEntry" form
would open.
What would be the best way to accomplish this?
I appreciate your help
 
Ad

Advertisements

G

Guest

Assuming your combo box row source is a value list, you could make it a two
column combo with the Description and the form name
cars;CarDataEntry;planes;PlaneDataEntry

Then in the after update event of the combo open the form:

Docmd.Openform Me.MyCombo.Column(1)
 
G

Guest

Klatuu,

thanks for your promp reply. How would I modify the code you suggest to open
a pivot table form, I already created them, I tried using the same code but
it didn't work, it just created a regular form.

I appreciate your help.
 
G

Guest

Klatuu,

thanks for your prompt reply. How would I modify the code you suggested to
open pivot table forms instead. I already created them. I tried the code you
send and It didn;t work, it just created a regular form.

I appreciate your help.
 
Ad

Advertisements

G

George Nicholson

How would I modify the code you suggest to open a pivot table form

Specify the view you want in OpenForm's 2nd argument:

Docmd.Openform Me.MyCombo.Column(1), acFormPivotTable
I tried using the same code but it didn't work, it just created a regular
form.
Well, odds are it didn't *create* anything, it just opened the form in
"acNormal" view (the default) rather than the PivotTable you wanted.
 
Ad

Advertisements


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