Error on query execution in VBA Excel using ADODB on SQL Server  
Author Message
FilipeCunha





PostPosted: Sat Sep 03 04:10:02 CDT 2005 Top

SQL Server Developer >> Error on query execution in VBA Excel using ADODB on SQL Server

We're trying to upsize from MS Jet (Access) db to SQL Server and am having a
major problem. Because we've not seen this error with the MS Jet db, I
suspect it's related to the user configuration in SQL Server.

The servername is "sqlbox" and the database name is "TCR". We use WinNT
authentication on the db and have a user profile for all our domain users.
The connection string executes, but the query does not. If the VBA Project
is unlocked, an error stating "Application Error...Unspecified Error" occurs
at the line noted below (--->). When the VBA Project is locked (normally),
the error states "Invalid object name" and then lists the database table (in
this example, "Version").

Here's the pertinent code:

strConn = "Provider=SQLOLEDB;Data Source=sqlbox;" & _
"Persist Security Info=False;Initial Catalog=TCR;" & _
"Integrated Security=SSPI"

Set adoConn = New ADODB.Connection
adoConn.ConnectionString = strConn
adoConn.Open

strSQL = "SELECT * from Version WHERE Version.Filename = '" & strFname & "';"

' open a recordset from Version table
Set adoRec = New ADODB.Recordset
adoRec.CursorLocation = adUseClient
---> adoRec.Open strSQL, adoConn <--- Error occurs here

I can run the application without problems; perhaps it is because I am the
dbowner (which implicitly grants me full access to the tables). However, I
have granted full access to the Domain User profile without success by any
other user.

Unless I find a way to solve this, there will be no migration! Thanks in
advance!

SQL Server204  
 
 
RD





PostPosted: Sat Sep 03 04:10:02 CDT 2005 Top

SQL Server Developer >> Error on query execution in VBA Excel using ADODB on SQL Server Hi Glenn
You posted in the wrong place. There is a dedicated new group forACCESS/SQL
SERVER/ADP Integration. You will get better answers there as they are
specialized in that.
Regards
R.D



> We're trying to upsize from MS Jet (Access) db to SQL Server and am having a
> major problem. Because we've not seen this error with the MS Jet db, I
> suspect it's related to the user configuration in SQL Server.
>
> The servername is "sqlbox" and the database name is "TCR". We use WinNT
> authentication on the db and have a user profile for all our domain users.
> The connection string executes, but the query does not. If the VBA Project
> is unlocked, an error stating "Application Error...Unspecified Error" occurs
> at the line noted below (--->). When the VBA Project is locked (normally),
> the error states "Invalid object name" and then lists the database table (in
> this example, "Version").
>
> Here's the pertinent code:
>
> strConn = "Provider=SQLOLEDB;Data Source=sqlbox;" & _
> "Persist Security Info=False;Initial Catalog=TCR;" & _
> "Integrated Security=SSPI"
>
> Set adoConn = New ADODB.Connection
> adoConn.ConnectionString = strConn
> adoConn.Open
>
> strSQL = "SELECT * from Version WHERE Version.Filename = '" & strFname & "';"
>
> ' open a recordset from Version table
> Set adoRec = New ADODB.Recordset
> adoRec.CursorLocation = adUseClient
> ---> adoRec.Open strSQL, adoConn <--- Error occurs here
>
> I can run the application without problems; perhaps it is because I am the
> dbowner (which implicitly grants me full access to the tables). However, I
> have granted full access to the Domain User profile without success by any
> other user.
>
> Unless I find a way to solve this, there will be no migration! Thanks in
> advance!