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

Error 13 ( Type mismatch

Hello everyone

Am having this error an just dont know what to do. Am using vb 6 and access database

This is my code

code vb:

Public db As Database
Public rs As Recordset
Public ws As Workspaces

Public Function initdb()
'On Error GoTo error
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(App.Path & "\resultchecker.mdb")
Set rs = db.OpenRecordset("candres", dbOpenTable)

Exit Function

am trying to open the database but it keeps giving type mismatch.
please help
Nov 14 '07 #1
14 3032
YarrOfDoom
1,247 Expert 1GB
I don't know anything about databases, but isn't it possible you have to declare ws as a workspace, instead of workspaces? (it's just a guess)
Nov 14 '07 #2
I don't know anything about databases, but isn't it possible you have to declare ws as a workspace, instead of workspaces? (it's just a guess)
Yes u are right i have change dat. I still have the error though
Pls help
Nov 14 '07 #3
Well you definately have two different data types, that's why you get the error. Did you define the data format explicit or not? - If not there might be an implicid definition that is not what you thought would be the implicit definition.

My try would be to use explicit definitions. (You should find out where the error is then)
Nov 14 '07 #4
Well you definately have two different data types, that's why you get the error. Did you define the data format explicit or not? - If not there might be an implicid definition that is not what you thought would be the implicit definition.

My try would be to use explicit definitions. (You should find out where the error is then)

Thanks for the reply
What do mean when u say explicit and implicit definations.
I have looked at all the variables i define and they are of the correct type.
what about the database how do i see the error.
am frustrated and a newbie
Nov 14 '07 #5
You can define variables explicit with the type or implicit without specifing a type.

Have you tried a data type match through some prog like TORA or SQLView or whatever of these suits your database type.
Nov 14 '07 #6
keign
8
in what line do you get the error?
Nov 14 '07 #7
keign
8
whats the word "candres"..? try removing the ""
Nov 14 '07 #8
SonnyH
7
I don't see anything wrong with the code.

If the error occurs on this line

Set db = ws.OpenDatabase(App.Path & "\resultchecker.mdb")

then most likely App.Path was not a good string. Try to replace App.Path with something else to see if it works

You can put your database in c:\data directory then try this

Set db = ws.OpenDatabase("c:\data\resultchecker.mdb")
Nov 14 '07 #9
Thanks for your replies. I have change the path name and put the database in c: directly but the error will not go away.

Any more suggestions will be kindly appreciated.

Thank.

This is my lastest code

code vb:

Public Function initdb()
'On Error GoTo error
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("c:\resultchecker.mdb")
Set rs = db.OpenRecordset("candres", dbOpenTable)
Exit Function
/ code

the line in bold is where the erro is coming from.

thanks
Nov 16 '07 #10
Thanks for your replies. I have change the path name and put the database in c: directly but the error will not go away.

Any more suggestions will be kindly appreciated.

Thank.

This is my lastest code

code vb:

Public Function initdb()
'On Error GoTo error
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("c:\resultchecker.mdb")
Set rs = db.OpenRecordset("candres", dbOpenTable)
Exit Function
/ code

The line in bold is where the error is coming from.

thanks
Nov 16 '07 #11
QVeen72
1,445 Expert 1GB
Hi,

Check what all References have been added to your Project.
To Check this goto menu : Project >> References

What I Guess is, "Microsoft ActiveX Data Objects" is also added.
Either Remove This Reference
OR
Declare Recordset as :
Dim RS As DAO.Recordset

"Recordset" is an Overloaded Class used in both "ADO" and "DAO"
To Identify between the two, you have to Pre-ceed with the Class Name..

Hope that helps..

Regards
Veena
Nov 16 '07 #12
YarrOfDoom
1,247 Expert 1GB
just something handy to know: you should put brackets ("[" and "]") around your tags ("code=vb" and "/code"), else they won't work.


Yarr
Nov 16 '07 #13
Mohan Krishna
115 100+
Hello gilsygirl,

Hope this would find u solve the problem!
Add "Microsoft DAO 3.6 Object Library" in the
PROJECT --->REFERENCES

ALL THE BEST!
Nov 17 '07 #14
Hello gilsygirl,

Hope this would find u solve the problem!
Add "Microsoft DAO 3.6 Object Library" in the
PROJECT --->REFERENCES

ALL THE BEST!
To all of you

Thank you very very much. The problem was exactly from the references. I removed the Microsoft ActiveX reference and it worked.

Thanks a million again
gilsygirl (Newbie)
Nov 20 '07 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Stephen Briley | last post by:
For some reason, my posts are scrubbed as attachments. Lets hope that sending from the yahoo account works. I'm new to Python and I'm trying to do some database work with MS Access, but I can't...
2
by: Steve Briley | last post by:
I'm new to Python and I'm trying to do some database work with MS Access, but I can't seem to get around a "datatype mismatch error".  Here's an example table that I'm working with... ...
6
by: DrewM | last post by:
This is a strange request - but I'm trying to generate a Type Mismatch error. It's for an example in some documentation. I was looking for something that would error (like a mathematical equation...
5
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
0
by: news.paradise.net.nz | last post by:
I have been developing access databases for over 5 years. I have a large database and I have struck this problem with it before but can find nothing in help or online. Access 2000 I have a query...
3
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line...
9
by: Prasad | last post by:
HI, I am a beginner in VC++.. I am trying to write a Win32 console application in visual studio.. I am using following header files.. #include <STRING> using namespace std; #include...
9
by: sara | last post by:
Hi - I have code (below) that ran as recently as Monday. We decided to change the location for the output reports, and now the code errors (13 Type Mismatch) on the query. The query runs fine...
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
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: 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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.