help - with recordset

N

need help!

Set Rs = Db.OpenRecordset("students", DB_OPEN_TABLE)

This had a runtime error "13". I entered a name in an
unbound combo box to search student names. Any ideas?

Thanks!
 
F

Frank Stone

well you could have given a little bit more but wild guess
you need a query to get a specific student. which i guess
you want since you entered a name in the combo box. here
you seem to be trying to open the whole table.
what are you trying to do with the record once you get it.
i am not sure just what error 13 is. did it give any thing
more specific?
 
G

Guest

Thanks for your help.....
I am entering a student name in the combo box, if it is
not there (by searching) through the student table, I
would then add a new student.

The error message "13" said it was type mismatch for that
line
 
D

Douglas J. Steele

It really would help if you included more of your code, and told us what
version of Access you're using.

My assumption is that you've got something like:

Dim Rs As Recordset

and that you're either using Access 2003, or that you're using Access 2000
or 2002, you've added a reference to DAO, but you didn't remove the
reference to ADO (and the DAO reference is lower in the list than the ADO
reference).

The problem is that Recordset is an object in both the ADO and DAO models,
so when your declaration is ambiguous, Access just takes the first one it
encounters.

Change it to

Dim Rs As DAO.Recordset

or if you're not going to be using ADO, remove the reference to it.

If you are going to be using a mix of DAO and ADO, you'd be well advised to
disambiguate your ADO declarations as well, just to be sure:

Dim Rs As ADODB.Recordset

The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and 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