Results 1 to 8 of 8
  1. #1
    twm07073 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    4

    Type mismatch Error after upgrading to Access 2010

    We are in process of upgrading our access XP database to Access 2010. I am testing this one database and getting Runtime error 13 “Type mismatch” when trying to open the form. The error is at "Set varRecSet = dbs.OpenRecordset(strPayQuery)"



    “strPayQuery = "SELECT Sum(SYSADM_PAYABLE_LINE.AMOUNT) AS MATERIAL " & _
    "FROM SYSADM_PAYABLE LEFT JOIN SYSADM_PAYABLE_LINE ON " & _
    "SYSADM_PAYABLE.VOUCHER_ID = SYSADM_PAYABLE_LINE.VOUCHER_ID " & _
    "WHERE (((SYSADM_PAYABLE.PAY_STATUS)<>'X') AND ((SYSADM_PAYABLE_LINE.WORKORDER_TYPE)='W') " & _
    "AND ((SYSADM_PAYABLE_LINE.WORKORDER_BASE_ID)='" & strSpecNo & "') AND " & _
    "((SYSADM_PAYABLE_LINE.WORKORDER_LOT_ID)='SPC' ));"
    Set dbs = CurrentDb
    Set varRecSet = dbs.OpenRecordset(strPayQuery)

    The weir thing is, if I open the same form in Access 2010 without converting database to access 2010 format, its work fine. Also works fine in Access XP.
    Any suggestions???
    Thanks.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    How is the recordset declared? You either need to disambiguate it or you have a reference problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    twm07073 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    4
    Thanks for the reply pbaldy.
    Here is the code for declaring the recordset

    Dim varRecSet As Recordset

    FYI - if I don't convert the database to 2010 then its work fine. but after converting to 2010 it doesn't work.
    Thanks again.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    TryDim varRecSet As DAO.Recordset
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't know why when I'm on an iPad it drops the carriage returns sometimes, but there should be one after "Try".
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    twm07073 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    4
    That did work. Thanks so much.

  7. #7
    twm07073 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    4
    Why it work for some but not for all?
    I also have couple other modules with OpenRecset and they work fine

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    When you don't disambiguate the declaration, Access doesn't know if you want a DAO or ADO recordset. It goes through the references in order, and my guess is the ADO reference was first, so it gave you the error. If the DAO reference had been first, it wouldn't have.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. run-time error '13' type mismatch
    By teebumble in forum Forms
    Replies: 8
    Last Post: 12-03-2012, 01:18 PM
  2. Replies: 1
    Last Post: 05-11-2012, 10:59 AM
  3. Error#13 Type Mismatch
    By Nistin27 in forum Access
    Replies: 8
    Last Post: 08-17-2011, 04:15 PM
  4. type mismatch error?
    By hlcarlin in forum Programming
    Replies: 1
    Last Post: 07-07-2011, 08:30 AM
  5. Error after upgrading to Access 2007
    By bmcclellan in forum Queries
    Replies: 9
    Last Post: 03-22-2010, 10:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums