Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate listbox with table fields

Status
Not open for further replies.

SteIT

Programmer
Nov 22, 2007
18
0
0
GB
I have a form (Send Email) which has a combobox (cmbCompany) which row source to table tblCompanies.CompanyName, and another combobox (cmbEmailType) which is linked to table tbleEmailType.

tbleCompanies is linked to tbleContacts (which has all contacts for each company including Email address), the relationship being companyNumber (key in tblCompanies).

What I have working is user selects Company name (cmbCompany) and Email type (cmbEmailType).

What I want to happen then is a listbox be podulated with all Company Contacts (from tblContacts) for selected company.

User can then selected contacts from listbox.

What I have then is a commandbutton which will create email for all selected contacts.




 
You should be able to modify this faq702-4289. You have a listbox dependant on two comboboxes.
 
Thanks MajP.
I think I can use this, the problem I am having is tblContacts doesn't have companyName field but is linked to Company using CompanyNumber (auto number when new company added to tblCompanies). I need to associate the companyNumber to the CompanyName selected in combobox, then look for records in tblContacts using ComanyNumber.
 
If you have a combo box with a row source that looks something like this

select companyNumber, CompanyName from tblCompany order by CompanyName

and combo box properties
column Count = 2
bound column = 1
column widths = 0";1"

You only see the second column, the company's name because the width of the first column is 0. However, the value returned from the combo box is the company number.


if the query returns
1 Microsoft
2 Intel
3 Sun

then the combo shows
Microsoft
Intel
Sun

if you chose sun the value of the combo is 3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top