PDA

View Full Version : VBA for Access


Sue Reitz
09-26-2002, 01:16 PM
I've used the following code a ton of times before and had no problems:

dim Record as Recordset

Set Record = Current Db.OpenRecordset("TableName")

In the new database I'm working on, I get "Run-time error '13': Type mismatch" on the second line.

Does anyone know what the HECK I'm doing wrong?

Obi-Wan Kenobi
09-26-2002, 01:26 PM
Have you set the references? In the VBA window, go to Tools References and make sure that Microsoft DAO 3.6 (or something close to that) is checked.

Sue Reitz
09-26-2002, 01:46 PM
Thanks for the suggestion. I tried it, but I got the same error message. Do I have to reboot for it to work?

I did check another database and it had that reference checked, so I don't know why this one didn't.

That list of references was pretty intimidating! Why did you think I might need that one?

Gates Is Antichrist
09-26-2002, 01:48 PM
Have you set the references? In the VBA window, go to Tools References and make sure that Microsoft DAO 3.6 (or something close to that) is checked.This, and UNchecking ADO, is the very first thing I do when I have database code. (in Office 2000)

Maybe I'm missing out on whatever good thing ADO does, but at least perfectly @#$%ing good code will run upon the 2 above changes.

Sue Reitz
09-26-2002, 02:02 PM
Thank you!!!

Obi-Wan Kenobi
09-26-2002, 02:20 PM
Other than unchecking, you can bump the DAO library up in the list as far as it will go.

Arlie_Proctor
09-27-2002, 09:46 PM
You may want to check into ADO as opposed to DAO. Microsoft is slowly trying to kill the latter, as it works only with the Jet database engine. ADO works with any ODBC data source including Oracle, Informix, DB2, and Excel -- you can do away with linked tables.

ADO also allows you to take advantage of triggering and passing parameters to stored procedures in SQL-Server and Oracle and it allows you to send native SQL statements to such database engines. That's a huge performance bang if your IT department supports it.