Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Another Simple Database connection

Posted on 2000-03-04
7
Medium Priority
?
159 Views
Last Modified: 2010-05-02
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.
0
Comment
Question by:scotts27
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 9

Expert Comment

by:Ruchi
ID: 2584359
You don't need to use New keyword in the declaration statement of Recordset.

What is "test_import"??? Is it the table or sql?
0
 

Author Comment

by:scotts27
ID: 2584378
Thanks. It is the name of the table.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2584396
Your code seems to be working fine!!! Can you explain me more about your problem?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:Ruchi
ID: 2584399
Are you using Access97 or Access2000?
0
 

Accepted Solution

by:
soosairaj earned 150 total points
ID: 2584532
Dear friend,
   for your problem,

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

  and one more think you have to do

2. you have to set the Reference priority  proper order. that means
Microsoft DAO 3.51 object library should come before Microsoft Active Data Objects 2.1  Library.
  for this you have to select the Project option  from the toolbar and select Reference and set it properly.

 i hope it should work.

Regards..
Raj

0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2584772
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
0
 

Expert Comment

by:soosairaj
ID: 2586238
if you are not using ADO then no no need to use ADO Reference
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question