Pass selection in multi-field listbox to query-based subform

L

LeAnne

Wow, back in m.p.a. after a long, long hiatus... long enough to have
forgotten much that I ever knew about Access (& hopefully relearn much I had
forgotten).

I'm working on a database of stream cleanup events held by volunteer
organizations. I have an unbound form with a combo box, and an unbound
listbox (showing 3 fields) that displays results based on the selection in
the cbo. The user selects the name of the organization from the cbo, and the
listbox displays all cleanup events that organization has done (eventID
(hidden), stream name, watershed, and cleanup date). I'd like for the user
to click on a listbox selection to open a subform, CleanupDetails, based on a
crosstab query, which shows the main trash types (tires, bulk items, mixed
recyclables etc.) and amounts collected for the eventID of the selected
cleanup event in the listbox. Should be easy...But I haven't done this in so
long. I can't link the master/Child properties because the main form is
unbound. Clearly I'm missing something vital. Help would be appreciated.
 
A

Arvin Meyer [MVP]

If I'm understanding correctly, what you need to do is feed the underlying
query which outputs to the XTab, with an ID (Key) from the ListBox. The Key
will probably be the first column, with the columnwidth set to zero.

The criteria for the query will be:

[Forms]![The Form Name]![TheListbox Name]
 
L

LeAnne

Hi Arvin, LTNS! Thanks for replying.

Arvin Meyer said:
If I'm understanding correctly, what you need to do is feed the underlying
query which outputs to the XTab, with an ID (Key) from the ListBox. The Key
will probably be the first column, with the columnwidth set to zero.

The criteria for the query will be:

[Forms]![The Form Name]![TheListbox Name]
--
Well, that's what I thought. However, the CleanupDetails subform isn't being
filtered to display ONLY the EventID selected in the Cleanup listbox...it
shows ALL of the event IDs in the listbox. Since this isn't a multi-select
listbox, I was hoping to avoid having to solve this via code, since I've
forgotten so much, but I have a sinking feeling that an event procedure is
the way to go here...something to call the xtab query based on the on the
ItemSelected property. Any suggestions would be most appreciated.
 

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