2nd combo box criteria based on 1st combo box

2nd combo box criteria based on 1st combo box

Post by tbmarli » Fri, 18 Jan 2008 07:00:13


I know there are plenty posts on cascading combo boxes (which I've
tried to utilize), but I'm still missing something. I'm trying to
have the second criteria in a combo box be based on the criteria
selected in the first combo box on a continuous subform. So far, I've
been successful in having the dropdown in the 2nd combo contain the
correct values which are based on the 1st combo box, but when I I
select the criteria from the dropdown, it automatically populates it
with the 1st value from my drop-down list regardless of whether I
picked that one or a different one. Also, originally, when I would go
to the next record on my form, it would delete the the 2nd combo box
value in the previous record that I had just entered. I tried to
remedy this by creating a text box which I postitioned over the 2nd
combo box and set its GotFocus event to the 2nd Combo box, but this is
getting populated with the value from the 1st combo box.

Here's my code:

Subform(continuous form named frmLetterTrackingSubform):
Record Source: SELECT tblLetterTracking.MasterID,
tblLetterTracking.LetterSent, tblLetterTracking.LetterSentBy,
tblLetterTracking.LetterSentDate, tblLetterTracking.LetterSentReason
FROM tblLetterTracking;
On Current: Private Sub Form_Current()
Me!LetterTrackingReasons.Requery ' (This is my 2nd
Combo Box)
End Sub

1st Combo Box:
Name: LetterSent
Control Source: LetterSent
Row Source: tblLetterSentTimes (this is a table with just 1 field,
"LetterSentTimes", and 3 records with the values: First,Second, and
Final.
After Update: Private Sub LetterSent_AfterUpdate()
Me!LetterTrackingReasons.RowSourceType = "Table/
Query"
Me!LetterTrackingReasons.RowSource =
"Qry_Find_LetterTrackingReasons" ' The code from this qry is as
follows: SELECT tblLetterTrackingReasons.Action,
tblLetterTrackingReasons.Reason FROM tblLetterTrackingReasons WHERE
(((tblLetterTrackingReasons.Action)=[Forms]![Frm_Escheat]!
[frmLetterTrackingSubform]![LetterSent]));
Me!LetterTrackingReasons.Requery
End Sub

2nd combo box:
Name: LetterTrackingReasons
Control Source: LetterSentReason
Row Source: Qry_Find_LetterTrackingReasons

Text Box:
Name: LetterSentReason-TextBox
Control Source: LetterSentReason
On Got Focus: Private Sub LetterSentReason_TextBox_GotFocus()
DoCmd.GoToControl "LetterTrackingReasons"
End Sub

Sorry, if there's too much info, but I wanted to make sure that I
didn't omit any important information.
 
 
 

1. Populate 2nd combo box based on value selected in first combo box?

2. 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.

3. populate 2nd combo box based on value selected in 1st

4. Combo box choices based on another combo box

5. limiting combo box selection based on another combo boxes sele

6. Auto Populate a Combo Box based on the user selection of another Combo Box

7. Filtering combo boxes based on a selection in another combo box

8. Basing subform combo box on mainform combo box

9. limiting combo box selection based on another combo boxes selectio

10. sum combo box based on other combo box

11. How to limit combo box list based on value in another combo box?

12. combo box based on a second combo box not working

13. combo box choices based on first combo box

14. filtering combo box entries based on the selection of another combo box

15. Changing row source in combo box 'B based on contents of combo box