How to Link a List Box With a Continuous Subform
Listbox in a continuous subform
Listbox in a continuous subform
Using AccessXP
Customers have multiple locations and there are multiple contacts at each
location. The tables are(simplified!):
Customer
CustomerID
CustomerName
Location
LocationID
CustomerID
LocationAddress
Contact
ContactID
LocationID
ContactName
I would like to create a form/subform that will show for a selected customer all
the locations. The subform needs to be continuous to do this. Then in the
subform I would like to show all the contacts for each location. I tried a
contact subform in the location subform but Access does not permit subforms in
continuous forms. I then thought about using a listbox in the location subform
to show the contacts but I can't get the listbox to change for each record; all
I get is the contacts for the first location.
How can I set up an unbound listbox that will display different records in each
location record? Or is there another way to display the contacts at each
location?
Thanks for all help!
Kristine
Listbox in a continuous subform
Why not make a second subform which shows the contacts for the selected
location? You'll have to link it to the first subform, and update it
automatically everytime you select a different location.
Gerrit
Kristine wrote ..
Quote:>Using AccessXP
>Customers have multiple locations and there are multiple contacts at each
>location. The tables are(simplified!):
>Customer
>CustomerID
>CustomerName
>Location
>LocationID
>CustomerID
>LocationAddress
>Contact
>ContactID
>LocationID
>ContactName
>I would like to create a form/subform that will show for a selected
customer all
>the locations. The subform needs to be continuous to do this. Then in the
>subform I would like to show all the contacts for each location. I tried a
>contact subform in the location subform but Access does not permit subforms
in
>continuous forms. I then thought about using a listbox in the location
subform
>to show the contacts but I can't get the listbox to change for each record;
all
>I get is the contacts for the first location.
>How can I set up an unbound listbox that will display different records in
each
>location record? Or is there another way to display the contacts at each
>location?
>Thanks for all help!
1. Unbound listbox in continuous subform
Goodday! I've posted this request on the database group, but maybe
it's better suited in here.
I have the following tables : CONTACTS (ContactID, FirstName,
LastName, Company, etc.), SHOWS (ShowID, ShowDescription) and
CONTACTSHOW (links the previous tables together so not to have a
many-to-many relationship -- has the ContactID and ShowID fields).
I have a main form with a couple of listboxes which are used for
querying the CONTACTS table. The results populate bound textboxes of a
CONTINUOUS subform. This is fairly simple and works just fine. The
problem starts with an UNBOUND ShowAttended listbox on the SUBFORM
(which appears on each record shows, just as the bound textboxes do).
I
need to populate those listboxes depending on the value of the
ContactID
textbox of each record in the subform.
Ex.: "ContactID 27 attended the Nashville and Las Vegas shows", then
only those two shows should show up in the listbox.
I'm able to programmatically reference each of ContactID's values by
moving through the recordset, but I'm unable to assign its value to a
particular record listbox -- I'd kinda need to reach
"lstShowAttended(i)"...
I'v tried binding the listbox by setting it's rowsource property a
Query :
"SELECT ContactShow.ShowID, Shows.ShowDescription
FROM Shows INNER JOIN detailsShow ON Shows.ShowID = detailsShow.ShowID
WHERE detailsShow.ContactID =
[forms]![frmQuery]![sfrmQuery]![txtContactID]"
If I try to "hard-input" the value of ContactID, the listboxes get
populated with the Shows attended by the ContactID I enter :
"SELECT detailsShow.ShowID, Shows.ShowDescription
FROM Shows INNER JOIN detailsShow ON Shows.ShowID = detailsShow.ShowID
WHERE detailsShow.ContactID = 22"
In the above query, which is the ROWSOURCE property of the Shows
listbox, I entered ContactID 22. After opening the form, all the
listboxes on the subform contain "Las Vegas", which is the show
ContactID 22 attended.
Thus, if anyone has experienced this sort of problem, I'd really
appreciate any input. I can go more in details, with code and such, if
needed.
Thanks in advance to anyone who helps,
Simon.
2. Date Day Question
3. Listbox in a continuous subform
4. Irrational modal actions by a form - maybe corrupt db?
5. Send To Mail Recipient Using Microsoft Outlook
6. Limiting size of listbox or continuous subform.
7. parameter type
8. Continuous Forms with a (continuous) subform !
9. Continuous subform in a continuous form?
10. continuous subform within a subform
11. subform based upon listbox based upon listbox
12. what subform events should I use to requery listbox on a subform?
Source: http://www.verycomputer.com/214_4976b8aae93cb3ca_1.htm
Enregistrer un commentaire for "How to Link a List Box With a Continuous Subform"