If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Combo box to display something else if field is blank
Hi I have a combo box in my form which uses the following query:
SELECT [CustomerID], [FirstName] & " " & [LastName] FROM Customers ORDER BY [FirstName] & " " & [LastName] However, if the both the firstname and lastname are blank in the Customer Table I need it to show the BillingAddress instead. Is this possible? My line of thinking is something like this: SELECT [CustomerID], [FirstName] & " " & [LastName] FROM Customers ORDER BY [FirstName] & " " & [LastName]; IFBLANK SELECT [CustomerID], [BillingAddress] FROM Customers ORDER BY [BillingAddress] But it doesn't seem to be right! Thanks so much Rachel |
#2
|
|||
|
|||
Combo box to display something else if field is blank
SELECT [CustomerID],
IIf([FirstName] Is Null AND [LastName] Is Null, [BillingAddress], [FirstName] & " " & [LastName]) AS CustomerName FROM Customers ORDER BY [FirstName], [LastName]; -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Rachel" wrote in message news Hi I have a combo box in my form which uses the following query: SELECT [CustomerID], [FirstName] & " " & [LastName] FROM Customers ORDER BY [FirstName] & " " & [LastName] However, if the both the firstname and lastname are blank in the Customer Table I need it to show the BillingAddress instead. Is this possible? My line of thinking is something like this: SELECT [CustomerID], [FirstName] & " " & [LastName] FROM Customers ORDER BY [FirstName] & " " & [LastName]; IFBLANK SELECT [CustomerID], [BillingAddress] FROM Customers ORDER BY [BillingAddress] But it doesn't seem to be right! Thanks so much Rachel |
Thread Tools | |
Display Modes | |
|
|