SQL ODBC Connection

B

Bythsx-Addagio

Does anyone know of a resource for learning to implement dynamic SQL Queries
with VBA? I have tried a few times to manipulate the SQL string but it seems
to be very sensitive and it is slow going figuring out what pieces I am
missing.

Basically I am looking to develop a method to allow the user to select from
a set of "And" statements then concatenate the SQL parts to result into the
finished CommandText string.

Any suggestions would be appreciated!

i.e.
'************
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=Database;UID=;PWD=;SERVER=data.com", _
Destination:=Range("A1"))
..CommandText = Array("")
..Name = "Query"
'************
 
D

Dick Kusleika

Does anyone know of a resource for learning to implement dynamic SQL Queries
with VBA? I have tried a few times to manipulate the SQL string but it seems
to be very sensitive and it is slow going figuring out what pieces I am
missing.

Basically I am looking to develop a method to allow the user to select from
a set of "And" statements then concatenate the SQL parts to result into the
finished CommandText string.

Any suggestions would be appreciated!

BA: If you find something, let us know. In the meantime, just be very
careful. :)

Sometimes I'll open up Access and create the query in there, then look at
the SQL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top