justforgroups
New Member
- Joined
- Mar 10, 2010
- Messages
- 26
Hi,
An awkward problem here I suspect!
Creating a pivot from a text file, read in via ODBC. This works fine, so naturally they want to change it
Currently:
lv_src has the value 'data.txt' and is a tab-delimited text file.
What is required is to order the incoming data by one of the fields. Something like this I suppose:
Proposed:
c_key has the value 'prod id'
However every variant of "Order By" I'm trying gives some sort of error.
Would very much appreciate any advice! I'm assuming Order By is the right way to go, but am not sure if the dot in the file name is causing problems, or is it just the syntax of Order By.
Thanks.
An awkward problem here I suspect!
Creating a pivot from a text file, read in via ODBC. This works fine, so naturally they want to change it
Currently:
Code:
Set objMyPivotCache = ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
With objMyPivotCache
.Connection = ConnectString
.CommandText = "Select * From " & lv_src
.CommandType = xlCmdSql
End With
What is required is to order the incoming data by one of the fields. Something like this I suppose:
Proposed:
Code:
.CommandText = "Select * From " & lv_src & " [B]Order By [" & C_key & "] ASC[/B]"
However every variant of "Order By" I'm trying gives some sort of error.
Would very much appreciate any advice! I'm assuming Order By is the right way to go, but am not sure if the dot in the file name is causing problems, or is it just the syntax of Order By.
Thanks.