If you're using Access 2000 or higher, DAO is not the default data access language, ADO is. The Database object is a DAO object.
In the VB editor, go to the Tools menu and choose References. Chances are Microsoft ActiveX Data Object is checked and Microsoft DAO 3.x is not checked. Uncheck the ADO reference if you don't need it, and check the DAO. Then try your code.