Cascading combo only showing one record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a cascading combo only showing one record.....

First time doing this, any suggestions?

I pulled my reference from mvps.org/access/forms.frm0028.htm

I have the select statement as the row source and the requery.afterupdate in
the first combo box.

THANKS!!
 
Hi awrex,

It sounds like the Where part of your select statement is referencing the
wrong table or query field, ie the Primary Key value, rather than a value
with multiple matches. Have you remembered that combobox columns() start at
(0) rather than (1)? (usually you get no responses this way but.....)

Can you post your actual code from the afterupdate event of the 1st cbo.

TonyT..
 
This is what I have in 2nd combo box for Row Source..
SELECT sub_vert_id, sub_vert FROM tbl_appgrp WHERE
sub_vert_id=forms!vers6k!vertid;

In the first combo box I have a requery after update...

Private Sub VertID_AfterUpdate()
Me!SubVertID.Requery
Me.SubVertID = Me.SubVertID.ItemData(0)
End Sub
 
In the form, for the combo boxes I have the second field shown but the
primary key being stored. Coulmn 1 is hidden but column 2 is visible, with
column 1 data being stored. Could this be why I'm only getting one record?
 
Hi Awrex,

awrex said:
This is what I have in 2nd combo box for Row Source..
SELECT sub_vert_id, sub_vert FROM tbl_appgrp WHERE
sub_vert_id=forms!vers6k!vertid;

In the first combo box I have a requery after update...

Private Sub VertID_AfterUpdate()
Me!SubVertID.Requery
Me.SubVertID = Me.SubVertID.ItemData(0) <<<<<<This line is your problem it is saying only show data in the first row of the combobox. If vertid has more than one value (I'm assuming it's the foreign key in tbl_appgrp) then the rest of the code should work, Although I would tend to set the rowsource for SubVertID here (VertID_AfterUpdate) and do away with Me!SubVertID.Requery, that way, if a user goes to that field after entering Null in the VertID they won't get any error messages.
TonyT..

End Sub
 
I got it to work.
I changed the Row Source SELECT statement for the 2nd combo box and changed
the requery for it based on cmb1 also.....

Now would I do the same if there is a third combo based on the 2nd?
 
You can go on doing the same for as many comboboxes as you like, the code
will only change to reflect new rowsources and field references.

TonyT..
 

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

Back
Top