Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003

    Question Unanswered: Connection Problem

    I have a problem with an mdb which is linked with another in a network server.
    I want to get some fields of a query and I'm using this:

    Dim rstAlarms as New ADODB.Recordset

    rstAlarms.Open "Qry_TracksServiceAlarm", CurrentProject.Connection

    But I get an error

    I thing that something is wrong with the connection string. The network drive is K on (Kokosis c. Kokosis is the computername of the server.

    Any idea?

  2. #2
    Join Date
    Mar 2004

    Re: Connection Problem

    Is the CurrentProject.Connection an ADODB connection object or a DAO connection object? That may be the problem.

    Here is some code to connect to an Access database, reterive data from Table1, close the recordset and close the connection using VBA with ADO.

    Dim cn as ADODB.Connection
    Dim rs as ADODB.Recordset

    Set cn = new ADODB.Connection
    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Test.mdb;Persist Security Info=False"

    set rs = new ADODB.recordset
    rs.ActiveConnection = cn
    rs.Open "SELECT * FROM Table1"

    Set rs=Nothing
    Set cn = Nothing

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Jul 2003

    Thumbs up Re: Connection Problem

    SCIROCCO Thank's for your interest. The problem was that the recordset I want to use is from a parametric query. That's why I get errors. I used ADODB.Command to set the parameters for the query and then I opened the connection.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts