Unable to make ACCDE (1 Viewer)

gene.zhou5

New member
Local time
Today, 04:33
Joined
Jan 19, 2018
Messages
6
Hi all,

I'm working with Access 2010, 32-bit on 64-bit Windows 7.

So I have an accdb file, which I'm trying to turn into an executable by going into File -> Save & Publish -> Make ACCDE -> Save As. Problem is, when I do that, I get a message saying:

"The command or action 'MakeMDEFile' isn't available now."

From what I can tell, the issue is caused by a form that's set to open whenever the file is opened. More specifically, that form has an "On Open" event which is supposed to hide the navigation bar. If I get rid of the event, then I can publish.

Interestingly enough, I could have an "On Open" event on that form with ABSOLUTELY NO CODE, and I will still get the above error when I publish. The only way I can seem to publish is if I completely get rid of the "On Open" event.

What I've tried so far:
-Debug -> Compile
-Open exclusive

Any ideas would be greatly appreciated. My only goal is that the users won't be able to see all the tables/queries/etc... once I deliver the executable to them.

Thanks in advance,
Gene
 

jleach

Registered User.
Local time
Today, 04:33
Joined
Jan 4, 2012
Messages
308
Odd. Doesn't sound like normal behavior.

A few things you can try to clean it up:

- MAKE A BACKUP!
- Decompile the app (www.fmsinc.com/microsoftaccess/performance/decompile.asp)
- Import everything into a new db and try again (decompile usually takes care of the same thing this would though)
- Create an AutoExec macro an a RunCode action to call a public function in a standard module which opens your form instead (and use that initial function call to do your startup work prior to requiring a form be open: this is my preferred method). Shouldn't have to do this though, many people do the form method as you've described without issue.

hth
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:33
Joined
Feb 19, 2002
Messages
43,257
Does the application compile without errors?

Perhaps the opening form is corrupted. Export the form to a new database. Delete it from the original (always make a couple of backups before embarking on anything like this). Remove it as the opening form. Compact the original database. Create a new, empty form in the original database. Open the original form in the new database in design view so you can easily copy controls and code. Then add it back as the opening form and compact again.
 

isladogs

MVP / VIP
Local time
Today, 09:33
Joined
Jan 14, 2017
Messages
18,211
Have you tried opening the database using the shift key bypass so that no forms are opened?
See if that allows the Save to ACCDE to work
 

gene.zhou5

New member
Local time
Today, 04:33
Joined
Jan 19, 2018
Messages
6
@jleach: No good, unfortunately.

@Pat_Hartman: For some reason, when I try to copy everything over to the new form, it keeps telling me "method or data member not found" for controls that clearly exist and are correctly spelled. Will have to keep trying, but your method seems like it may be the best option I have -> prior to creating a new form, it did compile with no errors.

@ridders: Shift key bypass lets me get just a little bit further and allows me to give the new file a name. Upon saving, though, I get another message saying that the file could not be created.

I appreciate the quick responses. I'll let you all know once I've figured it out. That said, additional suggestions are always welcome =).

-Update
Pat_Hartman's method of creating a new form ultimately didn't work. As soon as I put in the code for form open, I get the same error message.
:banghead:

Gene
 
Last edited:

gene.zhou5

New member
Local time
Today, 04:33
Joined
Jan 19, 2018
Messages
6
Figured it out. So apparently, I have to leave the form in design mode when publishing. What I'd been doing (by habit, I suppose?) was to write the code, compile, go back to form view, then publish. By skipping that second-to-last step, I was able to get my accde.

Not sure if that's the way it's supposed to be, but there we are.

Thanks again to everybody who posted suggestions.

Best,
Gene
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:33
Joined
Feb 19, 2002
Messages
43,257
When you publish an .accde, all object should be closed. Based on the method you outlined, the form in question in the .accde has no code so it won't work. Did you test it?

Please post the code for that form.
 

gene.zhou5

New member
Local time
Today, 04:33
Joined
Jan 19, 2018
Messages
6
When you publish an .accde, all object should be closed. Based on the method you outlined, the form in question in the .accde has no code so it won't work. Did you test it?

Please post the code for that form.

Hi Pat,

Not sure I understand what you mean. Are you saying I was unable to publish because I had a form with no vba code in the project? Because it was actually a specific line of code that seemed to be causing the issue:

Code:
Private Sub Form_Open(Cancel As Integer)

CommandBars("Status Bar").Visible = False
DoCmd.RunCommand acCmdWindowHide  'This line, specifically

End Sub

The interesting behavior was this:
-As soon as above code was put into the form -> can't publish
-Comment the code out, leaving just private sub / end sub -> still can't publish
-Completely delete the event -> CAN publish

I compiled without errors every time, but my issue was that I was compiling, saving, then going to form view and then trying to publish.

To solve the issue:
Compile, save, STAY IN DESIGN VIEW, publish.

About all objects being closed while publishing, I just tried it and it still threw the error. The only thing that seems to work is to keep the form open in design mode while publishing.

Best,
Gene
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:33
Joined
Feb 19, 2002
Messages
43,257
I have to admit, I don't have a clue what you are trying to do but it seems as though the acCmdWindowHide is referring to the active window which you just hid and that is why the code fails in the runtime. Try setting visible to true and see if you still get the error.

If commenting out both lines of code still fails, it sounds like the form is corrupted. You will probably have to rebuild the form.
 

gene.zhou5

New member
Local time
Today, 04:33
Joined
Jan 19, 2018
Messages
6
Yes, commenting both lines of code out still fails (even after closing the form). Also, I don't know why I didn't think to test this earlier, but I just created a brand new form based on a small table and the same code didn't block me from publishing, so it does seem like the form's corrupted.

But here's the interesting part: if I leave the form open in design mode, all of a sudden I can publish no problem.

I did rebuild the form once, but the same error still came up. I guess this is a mystery for now with a mysterious work around (thank Codd there's a work around to begin with =p).

Anyway, thanks to all for your help and suggestions. I hope this thread is useful for somebody else down the line.

Best,
Gene
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:33
Joined
Feb 19, 2002
Messages
43,257
Access is a very complex application and the fact that it works at all is a miracle. If you can get by this with a work around, I say go for it because it is not likely a "fix" or even an explanation will be forthcoming.
 

Users who are viewing this thread

Top Bottom