Can not make ACCDE (1 Viewer)

hfsitumo2001

Member
Local time
Today, 08:45
Joined
Jan 17, 2021
Messages
365
Anyone knows why I can not make my ACCDB to ACCDE?, this is the error message:
"Microsoft Access was unable to create the .accde, .mde, or .ade file."
I have not split yet to backend, because I want it for training first.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:45
Joined
Feb 28, 2001
Messages
27,197
The most common reason is that you have a compilation error in some part of your code.

Can you go into the VBA code and successfully perform a "Compile" (from the DEBUG menu, I think...)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:45
Joined
May 7, 2009
Messages
19,247
Add:
Option Explicit to each Module, Form/Report module.
then compile your Compile your db.
you need to resolve those errors before
you can successfully save your db to .accde/mde.
 

hfsitumo2001

Member
Local time
Today, 08:45
Joined
Jan 17, 2021
Messages
365
Add:
Option Explicit to each Module, Form/Report module.
then compile your Compile your db.
you need to resolve those errors before
you can successfully save your db to .accde/mde.
Arnel, If I put Option Explicit in every module, will the event procedure of each object still work?

Thank You
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:45
Joined
May 21, 2018
Messages
8,545
Option explicit will only force VBA to alert you when a variable is not declared when you hit debug compile. After adding option explicit you must compile the code. The concern is that the uncompiled code will not let you make the ACCDE, and it may not compile with undeclared variables.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 16:45
Joined
Sep 12, 2006
Messages
15,658
I thought @arnelgp would reply. If you do not pre-define variables, you can still use them, but vba will create them as variant types. If you spelled variables differently in different places., your programme may not work correctly, and you may find it hard to work out why.

So after you add option explicit and then compile the application you my find that you need to declare variables that you have used without declaring them.

(note you can set this a standard in your app - in a module do tools/options/require variable declaration set to true)

You also need to be aware of the scope of a variable. A variable can be declared to have scope within the whole application, just one form, or even just one procedure, which again has an impact on your coding.

Your programme not compiling may also be to do with syntax errors in code, that you may not even use. It's not necessarily down to variable declaration.
 

hfsitumo2001

Member
Local time
Today, 08:45
Joined
Jan 17, 2021
Messages
365
Option explicit will only force VBA to alert you when a variable is not declared when you hit debug compile. After adding option explicit you must compile the code. The concern is that the uncompiled code will not let you make the ACCDE, and it may not compile with undeclared variables.
How can I compile it MajP
 

hfsitumo2001

Member
Local time
Today, 08:45
Joined
Jan 17, 2021
Messages
365
The most common reason is that you have a compilation error in some part of your code.

Can you go into the VBA code and successfully perform a "Compile" (from the DEBUG menu, I think...)
ok I will Try it Doc_Man
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 16:45
Joined
Sep 12, 2006
Messages
15,658
When you do the compile, it will stop at the first error it finds, including your undeclared variables, so it may take some time to work through the whole database.
 

hfsitumo2001

Member
Local time
Today, 08:45
Joined
Jan 17, 2021
Messages
365
When you do the compile, it will stop at the first error it finds, including your undeclared variables, so it may take some time to work through the whole database.
Thank you Gemma, I can make now ACCDE, you guys are all awesome!
 

hfsitumo2001

Member
Local time
Today, 08:45
Joined
Jan 17, 2021
Messages
365
I thought @arnelgp would reply. If you do not pre-define variables, you can still use them, but vba will create them as variant types. If you spelled variables differently in different places., your programme may not work correctly, and you may find it hard to work out why.

So after you add option explicit and then compile the application you my find that you need to declare variables that you have used without declaring them.

(note you can set this a standard in your app - in a module do tools/options/require variable declaration set to true)

You also need to be aware of the scope of a variable. A variable can be declared to have scope within the whole application, just one form, or even just one procedure, which again has an impact on your coding.

Your programme not compiling may also be to do with syntax errors in code, that you may not even use. It's not necessarily down to variable declaration.
Gemma, after we make ACCDE, people still can modify the Switchboard thru Switchboard Manager in MS Access 2016. How can we prevent this.
 

Isaac

Lifelong Learner
Local time
Today, 08:45
Joined
Mar 14, 2017
Messages
8,775
@hfsitumo2001
To add to what everyone else has said, you have now identified a new practice that you should always do and never deviate from: Any and all modules should always have Option Explicit at the top of them (as gemma said, adjust your Tools Options to make it automatic) from now on.

Just to be clear
 

smtazulislam

Member
Local time
Today, 18:45
Joined
Mar 27, 2020
Messages
806
Add:
Option Explicit to each Module, Form/Report module
you need to resolve those errors.

I have also same problem.
And before some of form and Module not have "Option Explicit". Now I add all of FORM.

My any FORM dont have any error. I check one by one form to open.
but still I can't create .accde file.
What can I do now ?
 

Minty

AWF VIP
Local time
Today, 16:45
Joined
Jul 26, 2013
Messages
10,371
Can you compile your database in the VBA editor?

Debug ¬ Compile

Not having an error when you open a form is not enough. The Code HAS to compile.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 16:45
Joined
Sep 12, 2006
Messages
15,658
The fact that a form opens doesn't mean there's no error

There could be an error in code you haven't used yet.

Option Explicit means that you need to pre-define all variables. Compiling ensures that syntax is correct, and variables are declared throughout the database. If you can't produce an accde file, there will 100% be errors reported while compiling
 

isladogs

MVP / VIP
Local time
Today, 16:45
Joined
Jan 14, 2017
Messages
18,242
Also if you have any empty procedures with no code between the title line and the End Sub/Function line, you cannot create an ACCDE as Access doesn't know how to interpret such procedures. Recent versions of Access normally delete these automatically when you compile your code but it is possible this won't have happened if your app crashed at any point.
 

smtazulislam

Member
Local time
Today, 18:45
Joined
Mar 27, 2020
Messages
806
Also if you have any empty procedures with no code between the title line and the End Sub/Function line, you cannot create an ACCDE as Access doesn't know how to interpret such procedures. Recent versions of Access normally delete these automatically when you compile your code but it is possible this won't have happened if your app crashed at any point.
Thank you so much for your information.
Yes. That type of I have blank. Now I try to delete all
If I have Like below code. that should delete also ?
Code:
Private cmdDelete_Click
'something
'something
Sub End
Any code block, then should be delete
Answer please...
 

isladogs

MVP / VIP
Local time
Today, 16:45
Joined
Jan 14, 2017
Messages
18,242
If there are any comments between the header and End line, Access won't delete them automatically.
If the procedures contains nothing but comments either delete it completely or also comment out the First and last lines.

BTW the first line should be Private Sub cmdDelete_Click. As written, your code won't compile so an ACCDE won't ever be created.

Have you added Option Explicit as the second line in each code module and then compiled your project correcting all errors?
 

Users who are viewing this thread

Top Bottom