Solved

Why "type mismatch"

Posted on 2001-06-07
6
141 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
Comment Utility
You don't have a reference to the ADO library set do you?
0
 
LVL 2

Author Comment

by:abrusko
Comment Utility
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
Comment Utility
No, I don't.  I have a reference to DAO 3.51.  What should I have?

Thanks,
Andy
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 18

Accepted Solution

by:
deighton earned 75 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Deighton...the DAO prefix did it.  Thank you very much!

Andy
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

772 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

10 Experts available now in Live!

Get 1:1 Help Now