Vba code error

Anonymous
2021-09-29T01:06:53+00:00

Hello Every one,

As i am just beginners and I am make a database. And while I am making a database I face a lot of problem which i have shred here and get the solution nut now there is a error in vba coding which screen shot is attached in this question. Error says that user not define. I try to search what is the error and check the solution too. Further in reference MS access object library is selected. Please suggest me what other solution would be there to solve this error.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Tom van Stiphout 40,091 Reputation points MVP Volunteer Moderator
    2021-09-29T01:54:20+00:00

    Create a new database. Check its references. Observe there are 4. Those 4 should always be there and you should leave them alone. Select them for your database as well, and put them in the correct order.

    Beyond that, I see:

    Dim db as DAO.Database1_be

    Database1_be is not an Object in the DAO library. "Database" is. So this should be:

    Dim db as DAO.Database

    0 comments No comments
  2. Tom van Stiphout 40,091 Reputation points MVP Volunteer Moderator
    2021-09-29T01:55:43+00:00

    Also, make sure you have:

    Option Explicit

    at the top of every code module, and make it the default for future modules with <code window> / Tools / Options / Require variable declarations

    0 comments No comments
  3. DBG 11,531 Reputation points Volunteer Moderator
    2021-09-29T17:14:56+00:00

    To use DAO, you should have a reference set to "Microsoft Office 16.0 Access database engine Object Library."

    0 comments No comments