Solved

Access  Row Source Select Statement with If...else

Posted on 2009-05-19
2
754 Views
Last Modified: 2013-11-28
Hi

I have a form ComboBox control. In the RowSource I want to have a SQL statement that Selects the "Company" field from the "Contacts" table, but if this is blank then it selects the "First Name and "Last Name" together
0
Comment
Question by:murbro
2 Comments
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 24426499
Let me get this straight, from the contacts table, display company name but if that is null then display first and last name?

u can use iff

select iif(nz(Company,"")="",[First Name] & " " & [Last Name],Company) as Name


syntax is iif(condition,value if true,value if false)

nz is used to check for null string
0
 

Author Closing Comment

by:murbro
ID: 31583217
Thanks very much
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now