Solved

Another Simple Database connection

Posted on 2000-03-04
7
158 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 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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

615 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