Open form based on selection

G

Guest

I have a form [frm_modelselect] where I will select a chair model. Then I
want to hit a command, or just have a macro that runs onChange.
Either way, I want to open a specific form based on the Model that I
selected in [frm_modelselect].

How do I go about doing this?

Thanks in advance.
Travis
 
F

fredg

I have a form [frm_modelselect] where I will select a chair model. Then I
want to hit a command, or just have a macro that runs onChange.
Either way, I want to open a specific form based on the Model that I
selected in [frm_modelselect].

How do I go about doing this?

Thanks in advance.
Travis

A form is not the same as a control on the form.
Perhaps you mean you will select a chair model from a combo box on
the form.

If so, code the combo box AfterUpdate (not the Change) event:

DoCmd.OpenForm Me.ComboName
 
G

Guest

Okay, that worked.
But what if I want differenct selections to Open the same form?

For example. I have model numbers that I will select.
If I choose either "241810", "241914", or "242510", then I want to open
[frm_plasticback], But if I choose "241310", "243214" or "249914", then I
want to open [frm_veneerback].

What I have done so far is I put a command button in my form.
After I select the model that I want, then I click the botton.
My Event Procedure is OnClick and I entered
DoCmd.OpenForm Me.ModelSelect.

I named a few forms according to what was in my combo box, but I need to
have different selections open the same form.

Please Advise,
Thanks in Advance.

Travis

fredg said:
I have a form [frm_modelselect] where I will select a chair model. Then I
want to hit a command, or just have a macro that runs onChange.
Either way, I want to open a specific form based on the Model that I
selected in [frm_modelselect].

How do I go about doing this?

Thanks in advance.
Travis

A form is not the same as a control on the form.
Perhaps you mean you will select a chair model from a combo box on
the form.

If so, code the combo box AfterUpdate (not the Change) event:

DoCmd.OpenForm Me.ComboName
 
F

fredg

Okay, that worked.
But what if I want differenct selections to Open the same form?

For example. I have model numbers that I will select.
If I choose either "241810", "241914", or "242510", then I want to open
[frm_plasticback], But if I choose "241310", "243214" or "249914", then I
want to open [frm_veneerback].

What I have done so far is I put a command button in my form.
After I select the model that I want, then I click the botton.
My Event Procedure is OnClick and I entered
DoCmd.OpenForm Me.ModelSelect.

I named a few forms according to what was in my combo box, but I need to
have different selections open the same form.

Please Advise,
Thanks in Advance.

Travis

fredg said:
I have a form [frm_modelselect] where I will select a chair model. Then I
want to hit a command, or just have a macro that runs onChange.
Either way, I want to open a specific form based on the Model that I
selected in [frm_modelselect].

How do I go about doing this?

Thanks in advance.
Travis

A form is not the same as a control on the form.
Perhaps you mean you will select a chair model from a combo box on
the form.

If so, code the combo box AfterUpdate (not the Change) event:

DoCmd.OpenForm Me.ComboName

This is not the question you originally asked, nor is what you asked
appropriate for this question.

Let's get on the same page.
Why not re-think what it is you wish to do, and then ask that
question, this time giving all the pertinent details.
 
G

Guest

Sorry for the confusion, I didn't think it through very well before I asked
the Question. Let me try again.

I will have a Combo Box [ModelSelect] which is located in my form
[frm_ModelSelect]. I will select a "Model Number" from [ModelSelect], then I
will click a Command Button [cmd_ModelSelect]. When I push that button I want
to open a new form based on what I have just selected.
The issue I have is that different "Model Numbers" need to open the same form.

So model numbers 241810, 241814, 241910, and 242510 (along with others) will
all need to open the same form [frm_PlasticBack].
Likewise, model numbers 241310, 249914, 243210, and 241014 (along with
others) will all open [frm_VeneerBack]
There are also other groups that will open other forms

Is this obtainable by using a SELECT CASE in the Event Procedure for On
Click for [cmd_ModelSelect] ?
Or is there a better way to do this.

Thanks,
Travis
 
S

Stephen at ZennHAUS

Tdahlman said:
Sorry for the confusion, I didn't think it through very well before I
asked
the Question. Let me try again.

I will have a Combo Box [ModelSelect] which is located in my form
[frm_ModelSelect]. I will select a "Model Number" from [ModelSelect], then
I
will click a Command Button [cmd_ModelSelect]. When I push that button I
want
to open a new form based on what I have just selected.
The issue I have is that different "Model Numbers" need to open the same
form.

So model numbers 241810, 241814, 241910, and 242510 (along with others)
will
all need to open the same form [frm_PlasticBack].
Likewise, model numbers 241310, 249914, 243210, and 241014 (along with
others) will all open [frm_VeneerBack]
There are also other groups that will open other forms

Is this obtainable by using a SELECT CASE in the Event Procedure for On
Click for [cmd_ModelSelect] ?
Or is there a better way to do this.

Thanks,
Travis

Hey Travis

I agree with Fred that your question and explanations don't coincide. So,
let me try to make a little sense out of what you said.

I'm assuming:
1. you have a table with a list of chair models in it and that the table
feeds the combo box ModelSelect.
2. you have a number of forms that show some attribute of the chairs and
that these forms are all fed by the same table with a list of chair
attributes

If this is the case then you should have a relationship that connects the
table with models of chairs to the table with attributes of chairs.

So, assuming that the above components are in place, you should be able to
replace frm_PlasticBack and frm_VeneerBack with a single form. When you
click cmd_ModelSelect the code should include:
1. a variable that can be used to store criteria (Dim FormCriteria As
String)
2. a line of code to set the criteria (FormCriteria = "[ModelNumber]=" &
Me![ModelSelect])
3. the line of code to show the form (DoCmd.OpenForm
frm_ChairAttribute, , , FormCriteria)

Where:
[ModelNumber] is the related field used to connect the Attributes for to the
Chair model.
[ModelSelect] is the field used on the selection form before the button is
clicked
and frm_ChairAttribute is the form used to replaces the multiple forms you
currently have.

Stephen @ ZennHAUS
 

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

Similar Threads


Top