Results 1 to 5 of 5
  1. #1
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5

    Unanswered: Type mismatch on recordset

    I get the error on the last line here where I set rst
    I can't figure this out


    Dim db As Database
    Dim qdfPassThrough As QueryDef
    Dim qdfTemp As QueryDef
    Dim rst As Recordset
    Dim rstTmpProcessor As DAO.Recordset
    Dim timestamp As Single
    Dim strSQL As String
    Dim strRecordset As String
    'Dim dtstatdate As Date
    'Dim dtenddate As Date
    strRecordset = "Select * from tempProcessPaymnetsSFSAmount"
    Set db = CurrentDb
    Set rstTmpProcessor = db.OpenRecordset(strRecordset, dbOpenDynaset)
    dtStartDate = [Forms]![modal_getdaterange]![textDateStart]
    dtenddate = [Forms]![modal_getdaterange]![textDateEnd]



    Set qdfPassThrough = db.CreateQueryDef("djtempPassThroughQuery")
    qdfPassThrough.sql = "SELECT sum(transactions.TransactionAmount)as batchamount , processors.processorName, " _
    & "transactions.ProcessedOn " _
    & "FROM processors, transactions " _
    & "where processors.id = 87 and " _
    & "transactions.transactionType_id = 3 " _
    & "group by transactions.ProcessedOn ,processors.processorName"

    Debug.Print qdfPassThrough.sql

    qdfPassThrough.ReturnsRecords = True
    Set rst = qdfPassThrough.OpenRecordset(dbOpenSnapshot) ****Error occurs here
    Dale Houston, TX

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    A QueryDef object does not have any OpenRecordset method. Try:
    Code:
    Set rst = db.OpenRecordset(qdfPassThrough, dbOpenSnapshot)
    Also, it would be better to fully qualify all the database objects:
    Dim db As DAO.Database, Dim qdfPassThrough As DAO.QueryDef, etc...
    Have a nice day!

  3. #3
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Quote Originally Posted by Sinndho View Post
    A QueryDef object does not have any OpenRecordset method.
    Actually it does:

    QueryDef Object Members*[Access 2007 Developer Reference]
    Paul

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    I learned something today
    Have a nice day!

  5. #5
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5

    Resolved -

    It was the full qualification of DAO.Recordset
    Dale Houston, TX

Posting Permissions

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