473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Help with Database Object

I've recently returned to Access programming, having last worked
extensively in Access 97. I'm now using Access 2002. I am trying to
reuse some old code (from A97 days) and am having some troubles. The
following snippet no longer works in A2002.

Line 01 Dim rst As Recordset
Line 02 Dim db As Database
Line 03 set db = CurrentDb()
Line 04 set rst = db.OpenRecordset(TableName", dbOpenDynaset)

The code is returning a 'Run-time Error 13, Type Mismatch' Error on
line 04.

Any help would be greatly appreciated.

Scott
P.S. I did turn on DAO 3.6 in Tools|References

Nov 13 '05 #1
3 1550
<sc******************@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I've recently returned to Access programming, having last worked
extensively in Access 97. I'm now using Access 2002. I am trying to
reuse some old code (from A97 days) and am having some troubles. The
following snippet no longer works in A2002.

Line 01 Dim rst As Recordset
Line 02 Dim db As Database
Line 03 set db = CurrentDb()
Line 04 set rst = db.OpenRecordset(TableName", dbOpenDynaset)

The code is returning a 'Run-time Error 13, Type Mismatch' Error on
line 04.

Any help would be greatly appreciated.

Scott
P.S. I did turn on DAO 3.6 in Tools|References

You could also remove references which you are not using, e.g. ActiveX Data
Objects so you are not referencing more than one object model which has the
recordset object. However, you may be best just doing a find and replace
making sure you replace "As Recordset" with "As DAO.Recordset" and "As
Database" with "As DAO.Database". Then make sure the thing compiles.
By the way, is this a typo? db.OpenRecordset(TableName", dbOpenDynaset)
Should it be TableName with no quotes?
Nov 13 '05 #2

sc******************@gmail.com wrote:
I've recently returned to Access programming, having last worked
extensively in Access 97. I'm now using Access 2002. I am trying to
reuse some old code (from A97 days) and am having some troubles. The
following snippet no longer works in A2002.

Line 01 Dim rst As Recordset
Line 02 Dim db As Database
Line 03 set db = CurrentDb()
Line 04 set rst = db.OpenRecordset(TableName", dbOpenDynaset)

The code is returning a 'Run-time Error 13, Type Mismatch' Error on
line 04.

Any help would be greatly appreciated.

Scott
P.S. I did turn on DAO 3.6 in Tools|References


Well, you're part of the way there. You have to either:
1. move the DAO 3.6 library ABOVE the ADO library, OR
2. disambiguate references. i.e. dim rst As DAO.Recordset
3. deselect the ADO library.

Nov 13 '05 #3
sc******************@gmail.com wrote:
I've recently returned to Access programming, having last worked
extensively in Access 97. I'm now using Access 2002. I am trying to
reuse some old code (from A97 days) and am having some troubles. The
following snippet no longer works in A2002.

Line 01 Dim rst As Recordset
Line 02 Dim db As Database
Line 03 set db = CurrentDb()
Line 04 set rst = db.OpenRecordset(TableName", dbOpenDynaset)

The code is returning a 'Run-time Error 13, Type Mismatch' Error on
line 04.

Any help would be greatly appreciated.

Scott
P.S. I did turn on DAO 3.6 in Tools|References


Did you cut and paste or import the code from A97? Whenever I convert
an A97 database to a later version by opening it in the newer version,
I never have to worry about the references. I don't even have to put
DAO.Recordset.

James A. Fortune

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. ...
1
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here....
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
1
by: Alpha | last post by:
I have a Window based application that shows up still running in the task manager when I close it. It reaches the "this.close" statement and then it stops at the "}" at the section of the...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
4
by: Tarun Mistry | last post by:
Hi all, I have posted this in both the c# and asp.net groups as it applies to both (apologies if it breaks some group rules). I am making a web app in asp.net using c#. This is the first fully OO...
2
by: Mark | last post by:
Hi, I don't have a code problem. I have an understanding problem. This is a made up situation that mimics my real situation but it is easier to understand. 1. I call a web method with an...
5
by: AAJ | last post by:
Hi all FIRST THE BORING BITS....... I normally use a Database layer, a Business layer and a GUI layer. The GUI uses an Object data source to bind to the Business layer which in turn binds...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
3
by: jambonjamasb | last post by:
Hi I have two tables: email_tbl Data_table Data table is is used to create a Form Data_form
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.