A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Data Entry forms: use 1st combo box to filter next combo box?



 
 
Thread Tools Display Modes
  #1  
Old June 23rd, 2006, 07:36 PM posted to microsoft.public.access.forms
WildGourd
external usenet poster
 
Posts: 1
Default Data Entry forms: use 1st combo box to filter next combo box?

Hi there-
I'm new to he Access world -- self-trained through books and slogging
through trial & error. But, I've hit a wall:

Question (brief version): In a form created for data entry, can you use a
combo box in one control to determine the list of values in a following combo
box via a filter or query?

Details of relevant tables and form (challenge below):
The purpose of the data entry form ("frmFleet") is to enter the number of
vehicles in each company's "fleet" of vehicles. Each vehicle is identified
by its main ModelID and then its SubID. (for example: for a Honda Civic, the
Model = Civic, but then there are many versions of the Civic, which I call
SubModel).
The main form shows the CompanyName. The subform connects to the table
tblFleet, in order to enter data into tblFleet.
In this subform the database user will need to select a Model and then a
Submodel from a combo box before filling in quantity.

I do have a table "tblModelsubModel" with two columns (Model and SubModel)
which lists all potential submodels of main Models. I also have a table
"tblModel" that lists the main models as unique values.

Challenge:
I would like the data enterer to be able to select the Model from a
combobox. I want the SubModel combobox to ONLY list those submodels that go
with the main Model. (in other words, when Civic is selected in the Model
box, I only want the Civic-appropriate subModel values to be present in the
the SubModel combobox ). Can I do this??? It seems a pretty logical
feature, but I've failed to find any help content that tells me how.

Would love anyone's input.
Best,
W.G.

  #2  
Old June 23rd, 2006, 07:43 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Data Entry forms: use 1st combo box to filter next combo box?

That is called Cascading Combos
For the SubModel combo you need a rowsource that is filtered based on the
valule of the Model combo.
In your case, it would be something like
"SELECT SubModel FROM tblModelsubModel WHERE Mode = '" & Me.ModelCombo;"
Then in the after update event of the model combo, requery the submodel combo

Me.cboSubModel.Requery

As an aside, you probably don't really need the tblModel table. You can
filter it down to the unique model values with a row source for your model
combo with something like

"SELECT DISTINCT Model FROM tblModel;"


"WildGourd" wrote:

Hi there-
I'm new to he Access world -- self-trained through books and slogging
through trial & error. But, I've hit a wall:

Question (brief version): In a form created for data entry, can you use a
combo box in one control to determine the list of values in a following combo
box via a filter or query?

Details of relevant tables and form (challenge below):
The purpose of the data entry form ("frmFleet") is to enter the number of
vehicles in each company's "fleet" of vehicles. Each vehicle is identified
by its main ModelID and then its SubID. (for example: for a Honda Civic, the
Model = Civic, but then there are many versions of the Civic, which I call
SubModel).
The main form shows the CompanyName. The subform connects to the table
tblFleet, in order to enter data into tblFleet.
In this subform the database user will need to select a Model and then a
Submodel from a combo box before filling in quantity.

I do have a table "tblModelsubModel" with two columns (Model and SubModel)
which lists all potential submodels of main Models. I also have a table
"tblModel" that lists the main models as unique values.

Challenge:
I would like the data enterer to be able to select the Model from a
combobox. I want the SubModel combobox to ONLY list those submodels that go
with the main Model. (in other words, when Civic is selected in the Model
box, I only want the Civic-appropriate subModel values to be present in the
the SubModel combobox ). Can I do this??? It seems a pretty logical
feature, but I've failed to find any help content that tells me how.

Would love anyone's input.
Best,
W.G.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:57 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.