1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Access 2000 programming problem !!

Discussion in 'Software Development' started by ponneri, Feb 3, 2005.

Thread Status:
Not open for further replies.
  1. ponneri

    ponneri Thread Starter

    Jul 17, 2004
    Private Sub Form_Load()

    Dim db As database
    Dim rs As Recordset

    Set db = CurrentDb
    Set rs = db.openrecordset("sm")

    Debug.Print "Record count is : " & rs.RecordCount

    End Sub

    *********** I use the above code to open a table and display the no. of records. But I get an error message in access 2000. Run time error 13, "type mismatch" and dubugging halts on "Set rs = db.openrecordset("sm")" line.

    What is wrong ? Can someone help ?? Please !

    One more thing - As in vb6 do I have to set something like Project->References etc. in Access 2000 also for statements like "dim db as database" to work. If yes, where ?

    Thanks in advance.
  2. Rockn


    Jul 29, 2001
    Have you looked at the recordset sm to see if it is actually returning any recods?
  3. chasiv


    Mar 16, 2005
    You can go to the microsoft page support.microsoft.com/kb/q181542/ for your answer.

    If you have both an ADO and DAO Reference the order in which they appear is important or you will receive this error.
  4. OBP

    OBP Temporarily Banned

    Mar 8, 2005
    Type mismatch suggests you do not need the "" around the sm in the brackets as it is an object.
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/326221

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice