Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Why "type mismatch"

Posted on 2001-06-07
6
Medium Priority
?
152 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 18

Accepted Solution

by:
deighton earned 300 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

972 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