Results 1 to 3 of 3

Thread: Openrecordset

  1. #1
    Join Date
    Aug 2003
    Posts
    29

    Question Unanswered: Openrecordset

    When I use

    dim db as database
    dim rs as recordset
    set db = currentdb

    set rs = db.openrecord("qryMyQuery")


    ''''''''''''''''''''''''''''''''

    I get a 3061 runtime error. (To few parameters, expected 2...)

    The query runs fine if I run it from the Database window.

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465
    jnason
    Do something like this:
    Sub UKOrders()
    Dim dbs As Database, rst As Recordset
    Dim strSQL As String

    ' Devuelve una referencia a la base de datos activa.
    Set dbs = CurrentDb
    strSQL = "SELECT * FROM Pedidos WHERE [PaísDestinatario] = 'Reino Unido'"
    Set rst = dbs.OpenRecordset(strSQL)
    rst.MoveLast
    Debug.Print rst.RecordCount
    rst.Close
    Set dbs = Nothing
    End Sub
    Saludos
    Norberto

  3. #3
    Join Date
    Aug 2003
    Posts
    29

    Talking

    Thanks Norberto....

    I found my problem is what Im attempting will only work with tables in the current database. When running against linked tables is when the error occurs.

Posting Permissions

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