2nd combo box criteria based on 1st combo box

T

tbmarlie

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.
 

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