Minggu, 05 November 2017

Re: RE: [MS_AccessPros] Order By Issue

 

This work great. But I do have a question. Now my combobox is now being populated correctly but I can only select the first item in the list...


With Warm Regards,
 
Arthur D. Lorenzini
IT System Manager
Cheyenne River Housing Authority
Wk.(605)964-4265  Ext. 130
Fax (605)964-1070

"Valar Dohaeris"






On ‎Sunday‎, ‎November‎ ‎5‎, ‎2017‎ ‎12‎:‎08‎:‎31‎ ‎PM, 'Bill Mosca' wrmosca@comcast.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


 

Art – You state that the combo box value is a string. All strings must be qualified with either single or double quotes. I tend to use double quotes to avoid stumbling over words like O'Hara. But even then you might get a set of double quotes. To fix that I use Chr(34).

 

Dim strSQL as String

strSQL = "Select MainTitle.MainTitleKey, MainTitle.MainLevelTitle  FROM MainTitle " & _

"WHERE ArchiveKey = " & Chr(34) & Me.cmbCurrentECabinet.Value & Chr(34) & " ORDER BY MainLevelTitle"

Debug.Print strSQL

[Breakpoint Here]-->Me.cmbCurrentEFolder.RowSource = strSQL

 

Note you had one ending single quote but not one at the beginning of the string. Also you lacked a space before "Order By".

 

When you build a SQL string that isn't working properly the best way to debug it is to put a break point on the line right after the string. Then put a line before the breakpoint that reads:

Debug.Print

That will print the string exactly as the compiler sees it. Paste that in a query SQL window and run it to see what happens.

 

Regards,

Bill

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Sunday, November 05, 2017 8:03 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Order By Issue

 

 

Can some on help parse this string correctly:

 Me.cmbCurrentEFolder.RowSource = "Select MainTitle.MainTitleKey, MainTitle.MainLevelTitle  FROM MainTitle " & _
    "WHERE ArchiveKey = " & Me.cmbCurrentECabinet.Value & "'" & "ORDER BY MainLevelTitle"

 

When I run this it is concatenating the Order By with the value from the combo box...

 

The value in the combo box is a string...

 

Thank you,

 

Art Lorenzini

Sioux Falls, SD

 

 

__._,_.___

Posted by: Art Lorenzini <dbalorenzini@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar