Full Version: opening subform using combo box
UtterAccess Forums > Microsoft® Access > Access Forms
I have a database that I need help with. It is a Membership/Donor database for a nonprofit health organization. It consists of 5 tables: Organizations, OrgContacts, Individuals, Donors, and DonorDetails.
The Organizations table has the primary key OrgID, and secondary keys ConID and DonorID. The OrgContacts table has the primary key ConID, and secondary keys OrgID and DonorID. The Individuals table has the primary key IndID, and a secondary key, DonorsID. The Donors table has the primary key DonorID and a secondary key, DetailsID. The DonorDetails table has the primary key DetailsID and a secondary key DonorID.
In this database, Organizations, Individuals, and OrgContacts can be Donors, or Members, or potential Donors or Members. Members are not necessarily Donors, and inclusion in the non-donor tables are not reliant upon being a Member. An OrgContact can be a Donor without the Organization he or she is part of being a Donor. Note that Individuals are not associated with an Organization, or the Organization is the same as the Individuals name, such as Jane Doe, MD.
What I want to be able to do on the Donors form is to have a drop-down box with the Organizations, OrgContacts, and Individuals forms as selections. Selecting one would open the appropriate form as a sub form in the Donors form. After entering the data in the sub form, there should be a Save option which would update the appropriate table and close the sub form. Another option could be that the information added to the sub form is saved to the appropriate table and the subform is closed when the user moves to a new or different record in the Donors form.
Thanks for any help you can provide,
Russ Rollins
I would put the form names in a table with fields for the actual form name and the description you want to use for the combo box. In the combo box, you can show the description(0) and have the actual form name hidden(1).
On the combobox_afterupdate:
subform.sourceobject = combobox.column(1)

FOr you can just list the form names in the combo box:
subform.sourceobject = combobox
Thanks for the help. I understand the instructions for the combo box part of it, but not the form names in a table part. If the form name I want to open as a subform is called OrgContactsForm, then I create a table with OrgContactsForm as a field? So, when the user selects OrgContactsForm (or its description), that form will open as a subform in the form the combo box is in? What do I use as a data type? Do I need to set up relationships for this table? Do I need to include foreign keys in the table? As you can see, I am unfamiliar with some of the more advanced aspects of Access, particularly those involving code and events.
I just noticed what your form names are. they look descriptive enough just to list them in the combo box without referencing a table. I would just list the form names in the combo box and then in the combobox_afterupdate:

subform.sourceobject = combobox
Thanks for your help. I'll give it a try
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.