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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display two fields in record for a combo box field?

Status
Not open for further replies.

Fredofthreads

Programmer
Jul 14, 2009
8
0
0
CA
I am trying to display both the company name and the company name in the record for the "owner" field of an assets database. I have some customers who are a company and contact person, but the problem is the residential customers are only a contact person and no company. The list displays both company and contact, but the record only shows the company, blank for residentials. Is there any way around putting the res. customers name as the company name as well, as that would take time and weaken my database integrity?

Thanks,
C
 
You could use a simple combine in the combobox list rowsource:

[ContactsName] & ", " & [CompanyName]

This assumes you are using a hidden primary field key as the actual selection in the combo box.

If you want to get a bit more interesting, you can use an if to display the company name if there is one:

iif(isnull([companyname]), [ContactName],[CompanyName])



SeeThru
Synergy Connections Ltd - Uk Telemarketing and Telesales Services
and
Synergy Mobile Solutions - UK Mobile phones, land lines and call packages

 
SELECT [Contacts Extended].ID, [Contacts Extended].[Company], [Contacts Extended].[Contact Name] FROM [Contacts Extended] ORDER BY [Contacts Extended].[Contact Name]; Is what was there, when i try the simple combine, it just gives me the id, which was an autonumber for the primary key.
 
Every time i try your iif function it just deletes it? what do i put for row source type? arghh.. so frustrating.
 
my bad, but lets not worry about that, what did you mean by your post on that other one?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top