Access 2010 ACCDE file not running VBA code, ACCDB runs VBA code fine

Hi Experts

Problem statement: Access 2010 ACCDE file not running VBA code, ACCDB runs VBA code fine


Windows 7 64bit
Access 2010 Pro 32bit

Windows 8.1 64bit
Access 2010 runtime 32bit

Original Application/Database history
Access 2003 Front End, MDB for development, MDE in deployment
Access 2003 Back End, MDB in both development and deployment

Converted FE to Access 2010 by Compact and Repair, Compile, Compact and Repair, Save As ACCDB
BE left in Access 2003 MDB

The ACCDB file opens fine (opening screen is login with username and password text boxes and Login command button) The Login command button runs code as expected. FE application picks up data from BE database as expected.

Access 2010 Deployment
To produce ACCDE file suitable for deployment ACCDB file was Compact and Repaired, Save & Publish - Make ACCDE file. Produced ACCDE file with no errors.

On deployment machine application starts ok and displays Login form. However Login Command button does NOT appear to run any code. No error message given just doesn't function.

Back on development machine same thing ACCDE file does not appear to run VBA code, no error message. However by checking VB on development machine I can see only three references whereas in the ACCDB file i have four references. The missing reference is "Microsoft office 14.0 Access database engine Object Library".

If I drop that reference in the ACCDB file then clicking the login button immediately gives an "Compile error: user-defined type not defined" against a "Public dbs As Database" statement.

So my questions are: -

1. Is the missing reference my problem? (I think so).
2. Why would the reference by dropped during the Save As ACCDE function?
3. How can I get Access to keep this reference in rather than dropping it?

Best regards,

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
Is the ACCDE in a trusted location?
alansbAuthor Commented:
Hi Dale,

Thanks for your speedy reply.

Whoops meant to say that. Yes on both Development and Deployment the FE is in a trusted location. I used AddPath2010 to add the directory location to Trusted Locations on the Deployment machine as that is only running Access 2010 runtime.

Best regards,

Dale FyeOwner, Developing Solutions LLCCommented:
try declaring your database on that line (and everywhere else that you refer to either Database or Recordset) as DAO.

DIM db as DAO.Database
Dim rs as DAO.Recordset

Ever since A2000, you should actually explicitly declare the type of database or recordset object, and if you are using an Access BE, it should generally be DAO.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

alansbAuthor Commented:
Hi Dale,

Once again many thanks for the response.

I have modified all the VB code to use explicit DAO references as suggested and resolved any issues on recompilation. If I now produce a new ACCDE file from the ACCDB files, then the VBA code works as expected.

So it looks like the problem was the compiler not handling the implicit reference to the DAO library correctly when making the ACCDE file.

Many thanks for your support.

Best regards,

alansbAuthor Commented:
Excellent responses in both time and how quickly he got to the root of the problem.
Dale FyeOwner, Developing Solutions LLCCommented:
Glad to help, Alan.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.