Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Developer Toolkits / June 2004

Tip: Looking for answers? Try searching our database.

datatype mismatch error 13

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JingleBEV - 29 Jun 2004 20:52 GMT
Hi,

Iam coding data access application with database object and recordset.
Here' s my code
'------------------------------------------------------------------
Private Function CreateRecordSet() As Boolean
   Dim db As Database
   Dim rs As Recordset
       Set db = DBEngine.Workspaces(0).OpenDatabase(txtDBpath)
       sql = "SELECT * FROM TblMembers"
       Set rs = db.OpenRecordset(sql, dbOpenDynaset)            'THE ERROR
APPEARS HERE
       MsgBox "show this", vbOKOnly

   If Err.Number = 0 Then
      CreateRecordSet = True
       MsgBox "no error", vbInformation
   Else
       CreateRecordSet = False
       MsgBox Err.Description, vbCritical
   End If
End Function
'------------------------------------------------------------------

I got an error 13 at runtime that says "Type mismatch". I look at different
books and the internet but still convince myself that my code is OK. No
errors were found after OpenDatabase method, and the txtDBpath is correct,
TblMembers is one of the tables in the .mdb file
Can someone tell me why I got that error at runtime.

I am running
windows xp
visual basic 6,
mdb file was create in Access 2003 and converted to Access97

Thanks.
Paul Overway - 29 Jun 2004 21:51 GMT
Check your references (Tools|References).  You probably have a ADO reference
instead of a DAO reference.

Signature

Paul Overway
Logico Solutions, LLC
www.logico-solutions.com

> Hi,
>
[quoted text clipped - 32 lines]
>
> Thanks.
Bruce M. Thompson - 29 Jun 2004 22:47 GMT
> Iam coding data access application with database object and recordset.
> Here' s my code
[quoted text clipped - 6 lines]
>         Set rs = db.OpenRecordset(sql, dbOpenDynaset)            'THE ERROR
> APPEARS HERE
[...]
> I got an error 13 at runtime that says "Type mismatch".
[...]
> Can someone tell me why I got that error at runtime.
>
> I am running
> windows xp
> visual basic 6,
> mdb file was create in Access 2003 and converted to Access97

You obviously have references to both ADO and DAO. You should disambiguate in
your typing to avoid this problem:

   Dim db As DAO.Database
   Dim rs As DAO.Recordset

Note that only a recordset object is represented in both ADO and DAO but for
clarity purposes I have explicitly typed the database object also (there is no
database object in ADO).

Signature

Bruce M. Thompson, Microsoft Access MVP
bthmpson@mvps.org (See the Access FAQ at http://www.mvps.org/access)

>> NO Email Please. Keep all communications
    within the newsgroups so that all might benefit.<<
JingleBEV - 30 Jun 2004 02:35 GMT
Thanks for the feedback, guy

> > Iam coding data access application with database object and recordset.
> > Here' s my code
[quoted text clipped - 31 lines]
> >> NO Email Please. Keep all communications
>      within the newsgroups so that all might benefit.<<
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.