"Dim WHATEVER as database" not working in 2010

Gingertrees

Well-known Member
Joined
Sep 21, 2009
Messages
697
OK, I'm no expert in any form of VBA, but I know there were changes from VBA circa 2003 to the VBA used in Office 2010.

There are two routines I've tried to copy into Access 2010 modules that have errored at this point:

Code:
Dim whatever as Database
'database not defined

what has Database become in this new version?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
It still works but you have to have the DAO reference checked (which in 2010 would be the Microsoft Office Access Database Engine Object Library). If you are using the old mdb format you would need the Microsoft DAO 3.x reference instead.

Also, I usually make it more explicit -

Dim whatever As DAO.Database
 
Upvote 0
Ah, didn't know about that - thanks Bob! Activating the DAO 3.6, then rewriting as you suggested worked :)
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,174
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top