473,403 Members | 2,323 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,403 software developers and data experts.

A97: problem with Set rst = dbs.OpenRecordset("tblMyTable", dbOpenTable)

MLH
A runtime error 13 (type mismatch) occurs running the following line:

Set rst = dbs.OpenRecordset("tblMyTable", dbOpenTable)

What would be the most likely place I would find the source of the
error? The DAO code lines providing dependencies to this one are...

Dim dbs As Database, rst as RecordSet
Set dbs = CurrentDb

It seems so unusual to be encountering an error of this kind. I've
been using DAO for nearly a decade it seems and I don't remember
running into this problem before.
Nov 13 '05 #1
9 5349
MLH wrote:
A runtime error 13 (type mismatch) occurs running the following line:

Set rst = dbs.OpenRecordset("tblMyTable", dbOpenTable)

What would be the most likely place I would find the source of the
error? The DAO code lines providing dependencies to this one are...

Dim dbs As Database, rst as RecordSet
Set dbs = CurrentDb

It seems so unusual to be encountering an error of this kind. I've
been using DAO for nearly a decade it seems and I don't remember
running into this problem before.


The first thing I would look at is the Dim statement.
Dim rst As Recordset
however, you say recordset. I was thinking it might be "Recordsets" or
"Databases" or something you aren't dimming correctly. But your code
looks OK in the email.

Try
Dim rst As Recordset
Set rst = Currentdb.OpenRecordset("tblMyTable", dbOpenTable)

Nov 13 '05 #2
I've gotten this message too in the past. There's been 2 fixes for me.
1) Make sure my references are set right and 2) it was because
"tbl..." was a linked table and therefore couldn't be opened with
dbOpenTable

Nov 13 '05 #3
MLH
On 21 Oct 2005 14:39:18 -0700, ma**********@hotmail.com wrote:
I've gotten this message too in the past. There's been 2 fixes for me.
1) Make sure my references are set right and 2) it was because
"tbl..." was a linked table and therefore couldn't be opened with
dbOpenTable


Maybe its references. The table = local. I just unchecked 3 references
& set one. The three I unchecked DISAPPEARED after unchecking
them. I have no way to REcheck them now. The only three I have
checked are:

Visual Basic for Applications
Microsoft Access 8.0 Object Library
Microsoft DAO 3.51 Object Library
Nov 13 '05 #4
On Fri, 21 Oct 2005 17:02:40 -0400, MLH <CR**@NorthState.net> wrote:
A runtime error 13 (type mismatch) occurs running the following line:

Set rst = dbs.OpenRecordset("tblMyTable", dbOpenTable)

What would be the most likely place I would find the source of the
error? The DAO code lines providing dependencies to this one are...

Dim dbs As Database, rst as RecordSet
Set dbs = CurrentDb

It seems so unusual to be encountering an error of this kind. I've
been using DAO for nearly a decade it seems and I don't remember
running into this problem before.


Replace dbOpenTable with dbOpenDynaset.

Nov 13 '05 #5
MLH wrote:
A runtime error 13 (type mismatch) occurs running the following line:

Set rst = dbs.OpenRecordset("tblMyTable", dbOpenTable)

What would be the most likely place I would find the source of the
error? The DAO code lines providing dependencies to this one are...

Dim dbs As Database, rst as RecordSet
Set dbs = CurrentDb

It seems so unusual to be encountering an error of this kind. I've
been using DAO for nearly a decade it seems and I don't remember
running into this problem before.


A97 sort of started working with ADO instead of DAO. Check the references.

To be even clearer, change your declarations thusly:

Dim dbs as DAO.Database
dim rst as DAO.Recordset
set dbs = CurrentDB '<--VBA is smart enough to get this right...

....as it'll avoid any namespace collisions if you have both ADO and DAO
referenced.

Nov 13 '05 #6
On Sat, 22 Oct 2005 00:19:02 GMT, Wayne Gillespie
<be*****@NOhotmailSPAM.com.au> wrote:

Why? dbOpenTable is perfectly valid.
-Tom.
On Fri, 21 Oct 2005 17:02:40 -0400, MLH <CR**@NorthState.net> wrote:
A runtime error 13 (type mismatch) occurs running the following line:

Set rst = dbs.OpenRecordset("tblMyTable", dbOpenTable)

What would be the most likely place I would find the source of the
error? The DAO code lines providing dependencies to this one are...

Dim dbs As Database, rst as RecordSet
Set dbs = CurrentDb

It seems so unusual to be encountering an error of this kind. I've
been using DAO for nearly a decade it seems and I don't remember
running into this problem before.


Replace dbOpenTable with dbOpenDynaset.


Nov 13 '05 #7
MLH
Getting back to the "Basic 3" references took care of the prob.
I wish I had tried removing ambiguity using the more strict syntax
you suggested for the Dim statements first. But, I didn't and I damn
sure don't wanna go backwards just for testing - scares the crap
out-a-me. I'm fairly certain it would have been effective.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MLH wrote:
A runtime error 13 (type mismatch) occurs running the following line:

Set rst = dbs.OpenRecordset("tblMyTable", dbOpenTable)

What would be the most likely place I would find the source of the
error? The DAO code lines providing dependencies to this one are...

Dim dbs As Database, rst as RecordSet
Set dbs = CurrentDb

It seems so unusual to be encountering an error of this kind. I've
been using DAO for nearly a decade it seems and I don't remember
running into this problem before.


A97 sort of started working with ADO instead of DAO. Check the references.

To be even clearer, change your declarations thusly:

Dim dbs as DAO.Database
dim rst as DAO.Recordset
set dbs = CurrentDB '<--VBA is smart enough to get this right...

...as it'll avoid any namespace collisions if you have both ADO and DAO
referenced.


Nov 13 '05 #8
corey lawson <co**********@ayeteatea.net> wrote in
news:11*************@corp.supernews.com:
To be even clearer, change your declarations thusly:

Dim dbs as DAO.Database
dim rst as DAO.Recordset
set dbs = CurrentDB '<--VBA is smart enough to get this right...


CurrentDB occurs in two places in the Access object hierarchy (as
does DBEngine), once in the Access.Application object, and once in
DAO.

Because of that, you don't actually need a DAO reference to use
either CurrentDB or DBEngine. This means you can execute SQL with
Jet without needing a DAO reference.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #9
MLH <CR**@NorthState.net> wrote in
news:up********************************@4ax.com:
Getting back to the "Basic 3" references took care of the prob.
I wish I had tried removing ambiguity using the more strict syntax
you suggested for the Dim statements first. But, I didn't and I
damn sure don't wanna go backwards just for testing - scares the
crap out-a-me. I'm fairly certain it would have been effective.


Since you're in A97 and *not* using ADO, you can very easily to a
global search/replace (a new feature added after Access 2, probably
in A95). Just search for "As Recordset" and replace it with "As
DAO.Recordset" and you'll be set.

This is not terribly important in A97 by itself, but it's crucial
for any code that may get upgraded to a version of Access beyond 97,
where DAO was not a default reference, and where you could easily
have both ADO and DAO references in a single MDB file.

Get in the habit of doing it. You'll be glad you did when it comes
time to try using ADO for one of the handful of things it offers
that DAO lacks.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #10

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

Similar topics

5
by: Jozef | last post by:
Hello, I have an Access XP database that has attachments to a BE database that has a password. The attachments work fine, until I run some code that modifies a BE table (adding a field). I do...
2
by: danielst.clair | last post by:
I'm pulling customer testimonials from an SQL database onto the homepage of a site. I want to set a trim that will not allow more than 250 characters of the testimonial to show. Anything over 250...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.