First Published 4 Sept 2022

This article was prompted by a question posted by jeffhanner at AccessForums.net : Can't Save as ACCDE file

I'm trying to create an ACCDE file, however I get an error message that it can't create a .accde, .mde or .ade file.
I read where you can't have any references in VBA for .mdb or .accdb.
I removed one reference to .mdb and there are no others. I also compacted/repaired the database afterwards.

There must be something else I'm missing about the front end code or a setting perhaps. Any suggestions?



This scenario is certainly not an unusual occurrence and results in the following message:

      ErrorMsg1

Unfortunately, the message is very unhelpful as it gives no clues as to the reasons why creating the ACCDE (or MDE) file has failed.

In fact, I had the same problem yesterday when trying to create a 64-bit ACCDE. Creating the 32-bit ACCDE had worked without any issues.

There are a number of possible causes why ACCDE creation fails.
Several reasons are mentioned in this Microsoft article: Unable to create an MDE, ACCDE, or ADE database error

1.   The first thing to check is that your database compiles without error.
      Before you do so, you should ensure that require variable declaration is ticked in the VBE Options.

      RequireVariableDecs

      Doing that will add the line Option Explicit in the declarations section of all new code modules. However, it will not update any existing modules
      Check each code module in turn and add the line Option Explicit in the declarations section of each code module as shown below:

      OptionExplicit

      Now check whether the database compiles. To do so, open the Visual Basic Editor (VBE) and click Debug . . . Compile.

      DebugCompile

      If the command is 'greyed out', the project is already compiled.
      If not, the compiler will highlight any issues you need to fix. For example typos such as 'MsgBoxx' or undeclared variables used in procedures.
      Fix each of these in turn until the Compile menu item becomes 'greyed out'

      DebugCompile2

      Next try to create the ACCDE file again. If it fails, go to step 2

2.   Next check if you have any empty procedures with no code lines between the procedure header line and the End Sub/Function line. For example:

      EmptyProc

      NOTE: In recent versions of Access empty procedures should be automatically deleted when your project is compiled.
      However, if your project crashes or is forcibly closed these can be left behind as 'orphans'. The compiler doesn't know how to handle these so ACCDE creation fails

      If any empty procedures exist, delete them or add a comment line as below to keep them 'safely' for later use:

      EmptyProcComment

      Now try to create the ACCDE file again. If it fails again, go to step 3

3.   In the VBE, go to Tools ...References. Check whether any reference libraries are marked MISSING. If so, fix or remove those references

      Also check that none of your references are for ACCDB or MDB files. As those files are not compiled, they will prevent your file being saved as ACCDE

      ACCDBRef

      Either remove those references (if not needed) or convert those files to ACCDE first
      If you have made any changes in step 3, run Debug . . . Compile again and fix any new issues.

      Now try to create the ACCDE file again. If it fails again, go to step 4

4.   If you are using 64-bit Access, there may be issues with API declarations not being properly converted.
      The project may compile but the APIs and associated code may still be incorrect.

      In my own case yesterday, the APIs were correctly converted for 64-bit Access
      However, I had failed to update a related variable from Long to LongPtr as required by that particular API.

      You will need to go through the code line by line to identify and fix the issue(s). This isn't difficult but it can be tedious and time consuming to do.

      Now try to create the ACCDE file again. If it fails again, go to step 5

5.   Again, if you are using 64-bit Access, check whether you are using any older ActiveX controls in your project.
      Some old ActiveX controls such as Flexgrid or Treeview have not been converted to work in 64-bit Access

      NOTE: You would probably already know this as they wouldn't work in the ACCDB file either.
      In such cases, all you can do is try to get a 64-bit replacement or remove the ActiveX control from your project.

      Hopefully it will now work! If not, you may send me an email and I will try to offer other suggestions.



Please use the feedback form below to email me with any comments on this article.

If you found this article to be helpful in solving your problem, please consider giving a donation to help offset the costs of maintaining my website.

Thanks and good luck



Colin Riddington           Mendip Data Systems                 4 Sept 2022



Return to Access Blog Page




Return to Top