473,395 Members | 1,766 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,395 software developers and data experts.

open recordset gives type mismatch

1 Dim db As Database
2 Set db = OpenDatabase("c:\videoStore\settings.mdb")
3 Dim rs As Recordset
4 Set rs = db.OpenRecordset("defaults", dbOpenTable)
5 rs.MoveFirst
6 userType = rs.Fields(0)
7 storeNum = rs.Fields(1)

I'm pretty adept with VB6 but have stumbled when applying my knowledge to
Access 2003.

Line 4 gives me a 13 - type mismatch. The db exists and so does the
"defaults" table. Changing "defaults" to "anything" gives 3011 - Jet
database could not find the object 'defaults.' This shows me it can and does
find the correct table but I am stumped as to why the error occurs.

Help!

Cheers,
James
Feb 13 '06 #1
3 9935
> 4 Set rs = db.OpenRecordset("defaults", dbOpenTable)
Changing "defaults" to "anything" gives 3011 - Jet database could not find
the object 'defaults'


Correction - "Jet database could not find the object 'anything'

It must be late....
Feb 13 '06 #2
James wrote in message <CZ*******************@newsfe2-gui.ntli.net> :
1 Dim db As Database
2 Set db = OpenDatabase("c:\videoStore\settings.mdb")
3 Dim rs As Recordset
4 Set rs = db.OpenRecordset("defaults", dbOpenTable)
5 rs.MoveFirst
6 userType = rs.Fields(0)
7 storeNum = rs.Fields(1)

I'm pretty adept with VB6 but have stumbled when applying my knowledge to
Access 2003.

Line 4 gives me a 13 - type mismatch. The db exists and so does the
"defaults" table. Changing "defaults" to "anything" gives 3011 - Jet database
could not find the object 'defaults.' This shows me it can and does find the
correct table but I am stumped as to why the error occurs.

Help!

Cheers,
James


Try explicit declaration

Dim rs As DAO.Recordset

--
Roy-Vidar
Feb 13 '06 #3
Try explicit declaration

Dim rs As DAO.Recordset

--
Roy-Vidar


Yes, that's got it. Thankyou!
Feb 13 '06 #4

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

Similar topics

0
by: Sven Groot | last post by:
Using Outlook 2002 NL with all updates installed. I'm trying to open a backup pst file I have on CD. I have copied the file to my harddrive, made sure it's not read-only, am logged in as...
4
by: Max Harvey | last post by:
Hi, I have looked at the example called "Open Parameter queries from code" from the site http://www.mvps.org/access/queries/qry0003.htm I made up a test which I though looked pretty close...
0
by: BK | last post by:
Hi, I have a problem. I need to auto populate fields based on a value entered in combo box. Initially, I put all the required fields in the combo box, and hide it (set to 0",0",0", ...), then...
2
by: Sunil Korah | last post by:
I am having some trouble with opening recordsets. I have used code more or less straight from the access help. But still I am getting some errors. I am unable to work out what exactly I am doing...
8
by: aland | last post by:
Hi, I'm hoping someone can help me with this code. I'm getting a 'Type mismatch' error, and I'm not sure why. The SQL works fine in SQL view, so I'm not sure if that's the problem or not. This is...
4
by: Jozef | last post by:
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
5
by: dkintheuk | last post by:
Set rs = db.OpenRecordset("tblIncident") I'm getting a "Run-time error 13: Type Mismatch" this time. I've got Dim db as database and set db = currentdb DAO reference set up as well. The...
5
by: DBQueen | last post by:
I have a database where the user will have the opportunity to set up a number of Tests. I want the user to be able to enter the equation if a field for a particular test is to be a calculated...
2
by: Laphan | last post by:
Hi All I know you will probably say that I should use MS SQL Server DBs with ASP, but my MySQL and ASP combo works and is affordable for me and up until now didn't give me any grief until...
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: 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
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.