Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 24th, 2004, 08:02 AM
Registered User
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access SQL Statement to Format a Dropdown List

Hi All:

I am trying to get a dropdown list to show the items in Alpha order but can not get the SQL statement that works. Here is my current command line:

SELECT IIf([tblCustomerMain].[CustFirstName] Is Null,[tblCustomerMain].[CustLastName],[tblCustomerMain].[CustLastName]+", "+[tblCustomerMain].[CustFirstName]) AS CustomerName, tblCustomerMain.CID
FROM tblCustomerMain
WHERE (((tblCustomerMain.Office)=Get_OfficeID()));

I would like the Alias "CustomerName" to be listed by the CustLastName Alpha order. I greatly appreciate any help.

Thanks,

Lee
 
Old November 24th, 2004, 09:27 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

is your statement not working or your alpha order not ordered correctly?

You should be able to add order by custFirstName

Code:
SELECT IIf([tblCustomerMain].[CustFirstName] Is Null,[tblCustomerMain].[CustLastName],[tblCustomerMain].[CustLastName]+", "+[tblCustomerMain].[CustFirstName]) AS CustomerName, tblCustomerMain.CID
FROM tblCustomerMain
WHERE (((tblCustomerMain.Office)=Get_OfficeID()));
Order by CustLastName
Jaime E. Maccou
Applications Analyst
 
Old November 24th, 2004, 09:38 AM
Registered User
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The statement is working, just the order is not working correctly. I see
that I may have made a syntax error. I thought that the ; at the end of
the third line was the last command that could be entered. I will try your
suggestion.

Thank you very much.

Lee Jones

 
Old November 24th, 2004, 10:08 AM
Authorized User
 
Join Date: May 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am wondering why don't you create a query in Design mode, and then shift to SQL view and copy-paste the code?

Mihai






Similar Threads
Thread Thread Starter Forum Replies Last Post
convert a SQL Statement from MS Access to a SQL Corey Access 6 March 28th, 2007 12:33 PM
Data Access Page dropdown list blank? kalebson Access 1 October 4th, 2006 07:44 AM
Pass value from dropdown list to another ASP SQL Thamil Classic ASP Databases 19 August 29th, 2006 11:37 AM
Pass value from dropdown list to another ASP SQL Thamil BOOK: Professional Crystal Reports for VS.NET 0 August 25th, 2006 04:18 AM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.