Another Simple Database connection

Posted on 2000-03-04
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.
Question by:scotts27

Expert Comment

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?

Author Comment

ID: 2584378
Thanks. It is the name of the table.

Expert Comment

ID: 2584396
Your code seems to be working fine!!! Can you explain me more about your problem?
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.


Expert Comment

ID: 2584399
Are you using Access97 or Access2000?

Accepted Solution

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.


LVL 69

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

Expert Comment

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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now