Solved

Why "type mismatch"

Posted on 2001-06-07
6
143 Views
Last Modified: 2010-05-02
Hi,

Can someone please tell me why the fiollowing code is producing a Type Mismatch (13) error:

Thanks alot!!!
Andy
---------------------
Option Explicit
Dim dbFreight As Database
Dim rsRateTable As Recordset

Private Sub Form_Load()
Set dbFreight = DBEngine.Workspaces(0).OpenDatabase _
("c:\freightsystem\accessdbs\prodfreightmaster.mdb", , True)

Set rsRateTable = dbFreight.OpenRecordset("Select [weight] from [tstRateEngine]")

---------------------------
0
Comment
Question by:abrusko
  • 3
  • 2
6 Comments
 
LVL 4

Expert Comment

by:mcmahon_s
ID: 6163975
You don't have a reference to the ADO library set do you?
0
 
LVL 2

Author Comment

by:abrusko
ID: 6164010
No, I don't.  I have a reference to DAO 3.51.  What should I have?

Thanks,
Andy
0
 
LVL 2

Author Comment

by:abrusko
ID: 6164024
No, I don't.  I have a reference to DAO 3.51.  What should I have?

Thanks,
Andy
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 18

Accepted Solution

by:
deighton earned 75 total points
ID: 6164077
U should have DAO reference, you are correct.

Try

Option Explicit
Dim dbFreight As DAO.Database
Dim rsRateTable As DAO.Recordset

Private Sub Form_Load()


Set dbFreight = DBEngine.Workspaces(0).OpenDatabase _
etc...


I got you code to work,  which of the lines is the error on?
0
 
LVL 18

Expert Comment

by:deighton
ID: 6164099
Hit F2 & search for 'Recordset', you've probably got some other sort of recordset - but the
..as DAO.Recordset
prefix will sort it out.
0
 
LVL 2

Author Comment

by:abrusko
ID: 6164135
Deighton...the DAO prefix did it.  Thank you very much!

Andy
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now