Solved

Another Simple Database connection

Posted on 2000-03-04
7
157 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
Technology Partners: 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 50 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

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!

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

751 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