Combo box rowsource based on another combo box

  • Thread starter BonnieW via AccessMonster.com
  • Start date
B

BonnieW via AccessMonster.com

I have a form, on which I have a combo box which chooses a park. On that
form is a tab control; within that tab control is a subform containing
another tab control; on that tab control is a subform. I would like that sub-
sub-form to have a combo box from which the user can choose a point within
that park, chosen on the main form.

I found a bit of code from John Vinson, and tried to apply it here, but
perhaps I'm running into an issue with syntax, because it's just not working.

The code for my Parks combo box:
Private Sub Combo24_AfterUpdate()
Forms![ssfrmBirdsPointCounts]![Combo20].Requery
End Sub
Its rowsource:
SELECT [Natural_Area].[Natural_Area_ID], [Natural_Area].[NA_Name] FROM
[Natural_Area] ORDER BY [NA_Name];


The code on my Points combo box:
(none)
Its rowsource:
SELECT tblAvesPoints.AvP_Key, tblAvesPoints.AvP_BPoint_ID, tblAvesPoints.
AvP_NatArea_ID, tblAvesPoints.AvP_Name FROM tblAvesPoints WHERE ((
(tblAvesPoints.AvP_NatArea_ID)=[Forms]![frmBirds]![Combo24])) ORDER BY
tblAvesPoints.AvP_BPoint_ID;

Both combo boxes are bound, to different tables. I plan to use the same
basic setup & methods for two other sets of forms, so if I'm doing something
terribly wrong, please let me know.

Thanks in advance!
 
G

Guest

In your AfterUpdate event you need something like:

Me.subform1.Form.subform2.Form.Combo20.Requery

Steve
 
B

BonnieW via AccessMonster.com

Works like a charm! Thanks!
In your AfterUpdate event you need something like:

Me.subform1.Form.subform2.Form.Combo20.Requery

Steve
I have a form, on which I have a combo box which chooses a park. On that
form is a tab control; within that tab control is a subform containing
[quoted text clipped - 26 lines]
Thanks in advance!
 
B

BonnieW via AccessMonster.com

For posterity I suppose I should add that it worked at first, then didn't- I
eliminated the third subform and then screwed up the syntax with no good
backup, and this code didn't work anymore. So, after several iterations, and
most of the afternoon, I came up with:

Form.Subform1.Form.Subform2!combobox.Requery

Oddly enough, Access didn't "fix" the capitalization of the combobox name, so
I'm not sure that it's actually working *properly*- but it seems to be
working for now. I think. For the record, to keep things simple, the names
of the subform controls and the subforms themselves are the same, so that's
not the issue here. No idea what is, though. I'll no doubt find out as I
fuss with these forms more. :)

Thanks!
Works like a charm! Thanks!
In your AfterUpdate event you need something like:
[quoted text clipped - 7 lines]
 

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