I just tried it and I get the same thing.
Still going at it though, I won't give up! Here's what I have so far...
Public Sub SQLToExcel(sqlString As String)
Dim cnn As DAO.Database
Dim qdf As DAO.QueryDef
Set cnn = Application.CurrentDb
Set qdf = cnn.CreateQueryDef("", sqlString)...
No because this code is contained within a database which already has a connection open to a SQL server. CurrentDB is supposed to be a handle to that connection which you can point to.
However, at this point, I'll take any suggestions because nothing seems to be working :(
I dont know if my references are wrong or what, but I still get the same error, even with the code in the way that you mentioned there. I actually had it like that previously and then changed it.
I have DAO 3.6 up above ado etc etc... but i always get that error...
Is there some lame thing I am...
I'm trying to connect to the default DB in DAO so i cna create a temp query and do the following simple action:
-------------
Function SQLToExcel(sqlString As String)
Dim cnn As DAO.Connection
Dim qdf As DAO.QueryDef
Set cnn = CurrentDb
Set qdf = cnn.CreateQueryDef(Null, sqlString)...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.