program not run after compiling

db_john

Registered User.
Local time
Today, 14:28
Joined
Oct 1, 2009
Messages
15
I have a small Access 2007 project which is about 2MB in size. The project has 1 splash screen form, 1 main form with couples sub-forms; several tables, reports and 1 module. On loading of the accdb, the splash screen shows for fraction of second and then the main form displays. Since everything runs fine, I compile the project to accde.

When I run the accde, after clicking OPEN on security notice, the splash screen shows and then stops. If I change the display form to the main form in the Access Options, the main form shows but clicking on any button does not have the corresponding action.

Also, I have a customized record counter which shows the total no. of record. In accdb, it shows 222 records; in accde, it shows 11 records. If I directly open the table, I can see all 222 records.

I checked the reference libraries: In accdb, I have 4:VB for Applications, MS Access 12.0 Object, OLE Automation, MS Office 12.0 DB engine. But in accde, I lost the last one.

Is the missing DB engine object cause this problem and how to fix that? Thanks for your advices.
 
You can use several message boxes to display/debug the state of the running application.

Example:
Code:
private sub Form_Load()
    msgbox me.name 'To display the name of the form which is loading.
end sub
This code shows you that a form is loading and it displays its name.

HTH:D
 
Guus2005, thanks for your advice. I put the msgbox statement in the accdb. It works to display the form name. I compile the accdb and it does not display the msgbox.

I spent a lengthy time to find out what's happening starting some codes that I seldom use before. The codes are:
If Me.Application.CommandBars.Item("Ribbon").Height > 120 Then
SendKeys "^{F1}", False
End If

This is to hide the ribbpn such that I can have more screen area to display the interface. I rem them out and compile. The accde still does not run.

I then rem out all codes in the main interface. The accde then works. I then looked into each code lines and found that there is a sub without any codes inside like:

Private Sub cmdCtl_Click()

End Sub

I removed this sub and the accde then run now. I don't know why but it does in that way. Thanks.
 
RuralGuy, thanks for your suggestion.

Actually, I did import all objects the problematic db into a new fresh empty one but the problem persists. The problem is solved once I remove the sub which contains no codes or remarks at all.

Similar problem also happens in earlier version but the reaction is a little bit different. If I have an "empty" sub, the mdb cannot be compiled. But for the 2007, the accde can be compiled but the accde does not run. The different situations make me not thinking on the "empty" sub.

I would like others in the forum try for this situation.

1. Create a blank new accdb. No need to create a table.
2. Create and save a form with the following codes:
Option Compare Database

Private Sub Form_Current()

End Sub

Private Sub Form_Load()
MsgBox Me.Name
End Sub

3. Double click the form to see whether the form name is displayed. Then in the Access Option, Current Database, set the display form to this one.
4. Close the accdb, and run it. You should see the form name pops up.
5. Compile the accdb and run the accde. You won't see the same again. This happens even you double click on the form in accde.

Please let me know results of your test. Thanks.
 
Actually, are you making sure that your ACCDE is being run from the trusted location?
 
boblarson, before reading your reply, I didn't. After that, I added the folder containing the accdb and accde then re-compile the db. Re-run the accde, it still not works.

Thanks.
 
With nothing in the CurrentEvent when I compile the project, Access deletes the stub for the CurrentEvent which is consistant with earlier versions of Access.
 
RuralGuy, how do you know the Access deletes the Form_Current event as you cannot view any codes under the accde? Thanks.
 

Users who are viewing this thread

Back
Top Bottom