Question How to add list box in the main form's subform

Kristaline

New member
Local time
Today, 05:00
Joined
Mar 31, 2009
Messages
8
Hi all,

I have the main volunteer form. In the form I have volunteer info. In the subform ,which is a basic form layout, I have the companies details. The volunteer is doing the project for a particular company. I want to add the list box in the company's subform to show the list of projects related to that company. How I can add the list in already existing database?

Thanks for suggestions. Please help me on this.
 
Do the "list of projects related to that company" already exist in a table in your system?
 
Hi,

I have the Projects table. It consist of all projects' titles made as list box (but it shows all project titles) and their companies' names which are related to Company table.
 
The Company table should have a Primarykey (PK), usually an AutoNumber. and this PK should be in the relevent records in the Projects table and not the Company Name.
 
Hi RuralGuy,

Yes that's right. I have two tables:

tblProjects - PtojectId, EmployerId and ProjectTitle.
bblCompany - CompanyId, CompanyName, Address, Contact details, PhoneNo and etc.

I want to populate the list of company's existing projects. Therefore I have company's details in the subform and want only to add that list to be able to see its projects.

If you need more info please do ask me.
 
It is much easier to understand a table structure when you name the ForeignKeys with the same name they have in their primary table. I will assume that tblProjects!EmployerId and tblCompany!CompanyId are the same value. You can put a ListBox or a SubForm on the CompanyDetails SubForm that only shows the project for that company. A SubForm has the advantage of the LinkChild/MasteFields keeping it in sync for you but the ListBox is really quite simple as well. With a ListBox you simply need to tie the RowSource back to the CompanyId of the SubForm the ListBox is on.
 

Users who are viewing this thread

Back
Top Bottom