Error 2147467259(800004005) using ADO

  • Hello everyone,

    Not sure about if this is the place for this question but i hope someone can help me with this.

    I'm creating a VB6-Access app, i need to fill a MSHFlexGrid with a query from Access and i'm using the following code:

    Sub UpdateGrid()

    Dim conn As ADODB.Connection

    Dim rs As ADODB.Recordset

    Dim connString As String

    Set conn = New ADODB.Connection

    Set rs = New ADODB.Recordset

    connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Cesar\My Documents\Visual Studio Projects\VBVarios\Marbetes\InvenMarbetes.mdb;Persist Security Info=False"

    conn.Open connString

    rs.Open "SELECT * FROM DiferenciasConSAELiveD", conn, adOpenDynamic

    Set MSHFlexGrid1.Recordset = rs

    rs.Close

    Set rs = Nothing

    conn.Close

    End Sub

    This code works fine with the query: "DiferenciasConSAELiveD", which is a join from two tables...one from access and the other a paradox linked table.

    The problem is when i execute the same code but for a query "DiferenciasConSAELiveD" that has a join including an SQL Server linked table using ODBC , i get the error:

    Run-time error '-2147467259(800004005)':

    ODBC--connection to 'SAEMOTOSQL' failed.

    If i open the query "DiferenciasConSAELiveM" in Access it would ask me for a password to connect to the server, but for "DiferenciasConSAELiveD" no password is required. I guess the problem is that password....but how will i tell ADO that when opening this query it will have to use a password.

    Or maybe ADO cannot handle this kind of queries.

    Any advice is welcome!

    Victor.

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply