Access 2000 programming problem !!

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

ponneri

Thread Starter
Joined
Jul 17, 2004
Messages
3
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.
 
Joined
Jul 29, 2001
Messages
21,334
Have you looked at the recordset sm to see if it is actually returning any recods?
 
Joined
Mar 16, 2005
Messages
1
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.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
Type mismatch suggests you do not need the "" around the sm in the brackets as it is an object.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Staff online

Members online

Top