I use an ADO Connection to the DB and just piece together a string in Excel to query the DB, like so:
Dim sql As String
sql = "EXECUTE procLineLogEntriesDistinct
"'" & dailys.Range("A1").Value & "', '" & dailys.Range("B1").Value & "';"
There is also a way to pass cell values to Microsoft Query. It's been awhile and I forgot how, but I do remember that I found it very limiting on what you could do query-wise. So depending on your query complexity you have two different options there.
HTH,
Charly
Main Topics
Browse All Topics





by: SysExpertPosted on 2007-08-16 at 14:08:53ID: 19712478
Possibly, if you have multiple ODBC sources, you could choose the correct one based on a value in A1.
You may be also be able to create an ODBC query on the fly.
I hope this helps !