Solved

Why "type mismatch"

Posted on 2001-06-07
6
147 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: 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!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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 …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

749 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