Link to home
Start Free TrialLog in
Avatar of scotts27
scotts27

asked on

Another Simple Database connection

I have the following code that I swear was working. Now I get a type mismatch error. Can anyone shed some light on this..

Dim rs_test_import As New Recordset
Dim booksdb As Database

  Set booksdb = OpenDatabase("books2.mdb")
  Set rs_test_import = booksdb.OpenRecordset("test_import", dbOpenDynaset)

I am getting the type mismatch on the last line.
Avatar of Ruchi
Ruchi

You don't need to use New keyword in the declaration statement of Recordset.

What is "test_import"??? Is it the table or sql?
Avatar of scotts27

ASKER

Thanks. It is the name of the table.
Your code seems to be working fine!!! Can you explain me more about your problem?
Are you using Access97 or Access2000?
ASKER CERTIFIED SOLUTION
Avatar of soosairaj
soosairaj

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Éric Moreau
There maybe a problem with the reference. Do you reference both ADO and DAO in your app? If so, you have to prefixed your declaration this way:

Dim rs_test_import As DAO.Recordset
if you are not using ADO then no no need to use ADO Reference