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

ARGH! Type Mismatch on Set Recordset

Hello,

I hope someone can help, because I"m pulling my hair out! (and I need all
the hair I can get).

I have the following code;

Option Explicit
Option Compare Database

Sub TestItems()
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("TestTable")
End Sub

And when I run this code in A2K2 with DAO 3.6 included in the references, I
get a Type Mismatch error.

Any idea what's up with that?

Thanks!
Nov 13 '05 #1
4 2671
On Wed, 24 Aug 2005 03:12:03 GMT, "Jozef" <SP**********@telus.net>
wrote:

Perhaps you have another reference (ADO comes to mind) that defines a
recordset object. Disambiguate as follows:
Dim rst As DAO.Recordset

Btw, be explicit about what recordset you want to be returned by
OpenRecordset. E.g.:
Set rst = CurrentDb.OpenRecordset("TestTable", dbOpenSnapshot)

-Tom.

Hello,

I hope someone can help, because I"m pulling my hair out! (and I need all
the hair I can get).

I have the following code;

Option Explicit
Option Compare Database

Sub TestItems()
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("TestTable")
End Sub

And when I run this code in A2K2 with DAO 3.6 included in the references, I
get a Type Mismatch error.

Any idea what's up with that?

Thanks!


Nov 13 '05 #2
Thanks Tom,

That worked, but I'm wondering why I never encountered that before?
"Tom van Stiphout" <no*************@cox.net> wrote in message
news:vq********************************@4ax.com...
On Wed, 24 Aug 2005 03:12:03 GMT, "Jozef" <SP**********@telus.net>
wrote:

Perhaps you have another reference (ADO comes to mind) that defines a
recordset object. Disambiguate as follows:
Dim rst As DAO.Recordset

Btw, be explicit about what recordset you want to be returned by
OpenRecordset. E.g.:
Set rst = CurrentDb.OpenRecordset("TestTable", dbOpenSnapshot)

-Tom.

Hello,

I hope someone can help, because I"m pulling my hair out! (and I need all
the hair I can get).

I have the following code;

Option Explicit
Option Compare Database

Sub TestItems()
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("TestTable")
End Sub

And when I run this code in A2K2 with DAO 3.6 included in the references,
I
get a Type Mismatch error.

Any idea what's up with that?

Thanks!

Nov 13 '05 #3
"Jozef" <SP**********@telus.net> wrote in
news:wn%Oe.298308$5V4.48308@pd7tw3no:
That worked, but I'm wondering why I never encountered that
before?


Well, it's perhaps the fault of Microsoft for engineering A2K
stupidly to have newly-created MDB files include the ADO reference
but not the DAO record. On the other hand, files converted from A97
will include the DAO reference and no ADO reference. If you're
accustomed to working with converted MDBs, you likely would never
have encountered the missing DAO reference.

Microsoft has recognized the error of their ways and changed the
behavior in A2K3, if I'm not mistaken, to include DAO.

Either way, given the possibility of having both ADO and DAO
references (there are perfectly valid reasons for that), it's best
to disambiguate your uses of DAO and ADO object types as Tom
suggested.

I *never* use ADO, but I always explicitly indicate that I'm using
DAO, just in case my code should ever end up running in an
environment with an ADO reference that happens to be in the wrong
order.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #4
"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:Xn**********************************@216.196. 97.142...
"Jozef" <SP**********@telus.net> wrote in
news:wn%Oe.298308$5V4.48308@pd7tw3no:
That worked, but I'm wondering why I never encountered that
before?


Microsoft has recognized the error of their ways and changed the
behavior in A2K3, if I'm not mistaken, to include DAO.


True, but the ADO reference is higher in the list than the DAO reference, so
you definitely need to disambiguate declarations of DAO recordsets. (On the
other hand, I explicitly reference them even in Access 97, just so it's
obvious.)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

Nov 13 '05 #5

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

Similar topics

2
by: The Plankmeister | last post by:
Hi... I'm trying my hardest to understand fully how sessions work and how best to use them. However, all I can find is information that doesn't tell me anything other than that sessions store...
1
by: The Plankmeister | last post by:
I'm sure this should work: echo preg_replace("/(\w)(\!w)(\w)/","\\1\. \\3","this is.a test.to see. if it. works"); It should output: this is. a test. to see. if it. works But it doesn't....
2
by: Wired Earp | last post by:
I don't get it. First of all, it claims to run on a JRE. This is obviously a fraud, it even says so when you attempt to start it: "The JAVA_HOME variable should point to a JDK and not a JRE". I can...
3
by: The Plankmeister | last post by:
Hi... I'm attempting to keep everything I write compliant with xhtml 1.0 strict. And It's very bizarre. Why on earth won't this validate: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html...
1
by: Jim Moe | last post by:
Hello, I am (slowly) in the process of changing a table-based layout to CSS/div-based. One area that uses tables a lot is the main nav menu. I have discovered that tables have advantage: all...
1
by: Henry Rollins | last post by:
This is driving me nuts. I have created a Class Assembly in .NET C# which is to be used by traditional ASP pages. I registered it just fine with the regASM command and it work - about 2/3 of...
1
by: Cliff Williams | last post by:
How are people managing multiple, interdependent projects in the same solution? If I have to rebuild my solution file one more time, I think my head is going to spin around and pop off. I've...
0
by: Toby Mathews | last post by:
Hi there, I have a problem with a C# AP.NET app. running on my local machine, Sporadically (but more and more frequently) I get the above error message when code running on my laptop trys to...
1
by: RWC | last post by:
Hi Folks, I have a windows 2000 server installation, IIS is running and the ASP.NET 1.1 SDK has been installed. I'm reading a book on ASP.NET and the lessons call for the first line to read <%@...
6
by: darrel | last post by:
I'm using some validators for a form. I'm noticing that it writes the text out to the browser as a SPAN with it's visibility set to none. The problem is that it still takes up space, so I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.