Here's what I have..
SearchText = searchBoxtext.Value
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DefaultDir=C:\newsystest;Driver={Microsoft Text Driver (*.txt; *.csv)};DriverId=27;Extensions=txt,csv,tab,asc;FIL=text;MaxBuffe" _
), Array( _
"rSize=2048;MaxScanRows=25;PageTimeout=5;SafeTransactions=0;Threads=3;UserCommitSync=Yes;" _
)), Destination:=Range("E4")
.Sql = Array( _
"SELECT Widgets.`Part Number`, Widgets.Description, Widgets.`Qty on Hand`" & Chr(13) & "" & Chr(10) & "FROM Widgets.csv Widgets" & Chr(13) & "" & Chr(10) & "WHERE (Widgets.`Part Number` Like [SearchText]'%')" _
)
....and more
the "Like" part is what is not working. When I set the criteria value in Excel to "1" the string looks like this
Like '1%'. All I want to do is replace the "1" with the value from a textbox.....
I'm sure this is something simple but....
thanks for any help
paul
SearchText = searchBoxtext.Value
With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _
"ODBC;DefaultDir=C:\newsystest;Driver={Microsoft Text Driver (*.txt; *.csv)};DriverId=27;Extensions=txt,csv,tab,asc;FIL=text;MaxBuffe" _
), Array( _
"rSize=2048;MaxScanRows=25;PageTimeout=5;SafeTransactions=0;Threads=3;UserCommitSync=Yes;" _
)), Destination:=Range("E4")
.Sql = Array( _
"SELECT Widgets.`Part Number`, Widgets.Description, Widgets.`Qty on Hand`" & Chr(13) & "" & Chr(10) & "FROM Widgets.csv Widgets" & Chr(13) & "" & Chr(10) & "WHERE (Widgets.`Part Number` Like [SearchText]'%')" _
)
....and more
the "Like" part is what is not working. When I set the criteria value in Excel to "1" the string looks like this
Like '1%'. All I want to do is replace the "1" with the value from a textbox.....
I'm sure this is something simple but....
thanks for any help
paul