Type mismatch error

M

Mark

Why oh why do I get a Run-time Error '13' - type mismatch
error in the following code (Code is under the click
property of a button on a form):

Private Sub ProcessTransaction_Click()
On Error GoTo Err_ProcessTransaction_Click
Dim db As Database
Dim Members As Recordset
Dim Transactions As Recordset
Dim LastBalance As Recordset

Set db = CurrentDb
Set Members = db.OpenRecordset("Select_Members")
<<Error occurs here
'Select_Members is a select query

Any help is greatly appreciated. Thank you in advance.

..
 
M

Marshall Barton

Mark said:
Why oh why do I get a Run-time Error '13' - type mismatch
error in the following code (Code is under the click
property of a button on a form):

Private Sub ProcessTransaction_Click()
On Error GoTo Err_ProcessTransaction_Click
Dim db As Database
Dim Members As Recordset
Dim Transactions As Recordset
Dim LastBalance As Recordset

Set db = CurrentDb
Set Members = db.OpenRecordset("Select_Members")
<<Error occurs here
'Select_Members is a select query


This looks like a references issue. You probably have both
DAO and ADO libraries checked and they have some object name
in common, e.g. Recordset. If you did not intend to use ADO
then you should uncheck it to remove the ambiguity.

If you do intend to use both libraries (or even if not), you
can disambiguate the declarations by prefixing the objects
with the library name:

Dim db As DAO.Database
Dim Members As DAO.Recordset

or for ADO
Dim rs As ADODB.Recordset
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top