ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ADO SQL syntax query, using a variable (https://www.excelbanter.com/excel-programming/384798-ado-sql-syntax-query-using-variable.html)

Spike

ADO SQL syntax query, using a variable
 
I need to extract data from a csv file for a specific fund, i have the syntax
to do this by coding the fund name into the SQL string, but what is the SQL
statement syntax to use if you wish to use a variable to hold the fund name.
So instead of ....WHERE fund = 'XYZ'. i have tried WHERE fund= fundname.
Fundname being the variable holding the fund name. This produces an error.

I will be very grateful for any help in this
--
with kind regards

Spike

NickHK

ADO SQL syntax query, using a variable
 
Spike,
Try:
"SELECT .... WHERE fund=" & Chr(34) & fundname & Chr(34)

NickHK

"Spike" wrote in message
...
I need to extract data from a csv file for a specific fund, i have the

syntax
to do this by coding the fund name into the SQL string, but what is the

SQL
statement syntax to use if you wish to use a variable to hold the fund

name.
So instead of ....WHERE fund = 'XYZ'. i have tried WHERE fund= fundname.
Fundname being the variable holding the fund name. This produces an

error.

I will be very grateful for any help in this
--
with kind regards

Spike




Spike

ADO SQL syntax query, using a variable
 
Works like a dream thank you so much
--
with kind regards

Spike


"NickHK" wrote:

Spike,
Try:
"SELECT .... WHERE fund=" & Chr(34) & fundname & Chr(34)

NickHK

"Spike" wrote in message
...
I need to extract data from a csv file for a specific fund, i have the

syntax
to do this by coding the fund name into the SQL string, but what is the

SQL
statement syntax to use if you wish to use a variable to hold the fund

name.
So instead of ....WHERE fund = 'XYZ'. i have tried WHERE fund= fundname.
Fundname being the variable holding the fund name. This produces an

error.

I will be very grateful for any help in this
--
with kind regards

Spike






All times are GMT +1. The time now is 04:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com