Results 1 to 3 of 3
  1. #1
    Swarland is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Location
    Northumberland, UK
    Posts
    16

    "Type Mismatch" message

    I want the following code to run when the database opens the first form as the database is loaded

    Dim dbCurrent As Database


    Dim rstQuery As Recordset
    Dim strResponse As String

    Set dbCurrent = OpenDataBase("SoundinMotion.accdb")

    Set rstQuery = dbCurrent.OpenRecordset("qryalerts", dbOpenSnapshot)

    Do Until rstQuery.EOF
    strResponse = MsgBox("ATTENTION, ToDo Action No. " & [Todo_ID] & " is overdue", , "ToDo Reminder Overdue")
    rstQuery.MoveNext
    Loop

    However, when the form opens I get the "Type Mismatch" error message on the Set rstQuery line.

    I have copied this from the Access Help file 'Recordset Object', but using my own data names.

    The query qryAlerts works just fine in stand-alone mode. using Access 2007 with XP

    regards

    Roger

  2. #2
    SteveH2508 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Chelsea, London, England
    Posts
    117
    Try disambiguating your variable declarations between ADO and DAO

    Dim dbCurrent As DAO.Database
    Dim rstQuery As DAO.Recordset

  3. #3
    Swarland is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Location
    Northumberland, UK
    Posts
    16
    Steve,

    Many thanks, that works a treat.

    Roger

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

Similar Threads

  1. Replies: 11
    Last Post: 11-26-2010, 10:53 PM
  2. Replies: 8
    Last Post: 11-12-2010, 10:55 AM
  3. Error message and How do I find the "value Field" ?
    By createdwithfire in forum Forms
    Replies: 1
    Last Post: 11-05-2009, 12:26 PM
  4. aSTR = Dir("C:\*.*") >> "Type Mismatch"
    By JGrant in forum Programming
    Replies: 1
    Last Post: 03-28-2009, 05:17 AM
  5. "Type Mismatch" Error
    By elmousa68 in forum Access
    Replies: 2
    Last Post: 12-05-2006, 08:28 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