You need to define the reference before automating Access. Do this from the VB Editor / tools/ References and tick the reference to Microsoft Access 16.0 Object Library. I've edited this post to give examples of opening the full database and opening it using DAO, which gives you control of the tables and queries as record sets, but not anything else.
DAO and early binding
If you are going to share this with users of older versions of Office, you will need to use late binding instead. You do not need to set a reference in the VB Editor with late binding. This example opens the application rather than the tables and queries.
Bookmarks