View Single Post
  #3  
Old April 27th, 2004, 03:07 PM
Sandra Daigle
external usenet poster
 
Posts: n/a
Default Using OpenRecordset

Hi Conor,

I am guessing that you are using Access 2000 or 2002 and that you're missing
the reference to the DAO Library. Open the module in the Visual Basic Editor
(VBE) then click Tools-References. Make sure that the Microsoft DAO 3.x
Object Library is checked. You might also want to check this article details
and info on how to fix the problem:

http://www.mvps.org/access/bugs/bugs0031.htm

I would also recommend that you fully declare your variables including the
library name from which they come. By disambiguating your declarations,
Access doesn't have to guess which Recordset you want (the ADO and DAO
libraries both have recordset objects). This also makes your code more
readable and somewhat more efficient. Here's an example:

dim rst as DAO.recordset

--
Sandra Daigle [Microsoft Access MVP]
Please post all replies to the newsgroup.


Conor Grogan wrote:
I have a button on a form called "command9". When this is clicked I
want to go through all the entries of a table called, "Device Table".
I using the following code:

Private Sub Command9_Click()
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("Device Table")
With rs

Do Until .EOF


I am getting the following error, "Runtime error '13': Type
Mismatch". Have I declared rs wrong? How can I over come the problem?
Can this be run on queries as well as on tables? Any help would be
much appreciated.