Solved

Another Simple Database connection

Posted on 2000-03-04
7
156 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
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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…

820 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