How to repair an application (1 Viewer)

inacio

Registered User.
Local time
Today, 23:49
Joined
Nov 15, 2017
Messages
12
I have used and programmed databases long before Microsoft Access came into existence. I have even made some small programs using Access.
However not in recent years.
In my work, several years ago, I had to produce once every month a list of income and expenses and I found a ready-made template in Hebrew, very much appropriate for my needs and I have been using it since.
Now, this application has stopped working and I am in trouble because I almost forgot anything and I cannot find where the trouble is.
The application uses a Switchboard menu.
When I click on Switchboard it starts showing the first menu but stops at the button of the first item and shows this error:
"The expression On Clik you entered as the event property setting produced the following error: The expression you entered has a function name that Microsoft Access can't find".
Now, I looked into the expression and it says: "=HandleButtonClick(1).
The following lines have similar expressions (2), (3), (4), etc.
In Switchboard items, numbers seem to be correct.
The Database is there and I managed to produce last months report by starting in the second menu of the Switchboard.
However I would like to understand what happened and make the necessary correction.
Any tips for further troubleshooting will be appreciated.
Thank you
Inacio
 

isladogs

MVP / VIP
Local time
Today, 21:49
Joined
Jan 14, 2017
Messages
18,246
Hi

As a starting point, hold the Shift key down whilst you open the database.
This will bypass any startup code so the errors won't prevent in loading

Now click to Database Tools ... Visual Basic.
The Visual Basic Editor (VBE) will open.
Click on Debug... Compile.
Access will go through the code stopping at each compilation error it finds.
Fix each error or disable that section of code
Repeat as often as necessary until the code compiles - the Debug..Compile item will then be disabled.
Close the VBE
Click Database Tools ... Compact & Repair.

Close & reopen the database normally.

If it still doesn't work, there are other things you can try but do that first
 

inacio

Registered User.
Local time
Today, 23:49
Joined
Nov 15, 2017
Messages
12
Thank you for helping me.
So far I reached the Debug menu, but the line "Compile" is grey and doesn't run.
 

isladogs

MVP / VIP
Local time
Today, 21:49
Joined
Jan 14, 2017
Messages
18,246
OK so that means it is already compiled

did you do a compact & repair? If not do so.

Before you go any further, recommend you make a backup copy of the db

Next... still in the VBE, click Tools ... References
Check if any are marked MISSING.
Note them carefully or do a screenshot.

If so, you will need to find the reference library on your computer & add it.
Alternatively, untick the MISSING reference & see if its still compiled
 

inacio

Registered User.
Local time
Today, 23:49
Joined
Nov 15, 2017
Messages
12
Three items are checked:
- Visual Basic for Applications
- Microsoft Access 16.0 Object Library
- OLE Automatation

Does this mean that they are missing?
 

isladogs

MVP / VIP
Local time
Today, 21:49
Joined
Jan 14, 2017
Messages
18,246
No. They are the default references so that's fine

Suggest you now examine the switchboard code that errors.
Step through the code line by line if necessary to identify what the function is causing problems.
Then look at the function itself which should exist as you've no compile errors
 

inacio

Registered User.
Local time
Today, 23:49
Joined
Nov 15, 2017
Messages
12
Pardon my ignorance, but please be more specific.
How do I look at the code? and the functions?

F8 is grey, as is Step in
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 21:49
Joined
Jan 14, 2017
Messages
18,246
Open the VBE as before
Find the code used for the switchboard event that fails
Click on the margin to the left of the code and add one or more breakpoints
They will look something like this



Run the code - it will stop at each breakpoint.
Click the green arrow in the VBE toolbar (or press the F5 key to go to the next breakpoint. Continue till it fails. Note the error

You can also do other things like step into etc ...
This is from the VBE help file:

Step Into, Step Over, Step Out Commands (Debug Menu)

Step Into

Executes code one statement at a time.

When not in design mode, Step Into enters break mode at the current line of execution. If the statement is a call to a procedure, the next statement displayed is the first statement in the procedure.

At design time, this menu item begins execution and enters break mode before the first line of code is executed.

If there is no current execution point, the Step Into command may appear to do nothing until you do something that triggers code, for example click on a document.

Toolbar button: Toolbar button. Keyboard shortcut: F8.

Step Over

Similar to Step Into. The difference in use occurs when the current statement contains a call to a procedure.

Step Over executes the procedure as a unit, and then steps to the next statement in the current procedure. Therefore, the next statement displayed is the next statement in the current procedure regardless of whether the current statement is a call to another procedure. Available in break mode only.

Toolbar button: Toolbar button. Keyboard shortcut: SHIFT+F8.

Step Out

Executes the remaining lines of a function in which the current execution point lies. The next statement displayed is the statement following the procedure call. All of the code is executed between the current and the final execution points. Available in break mode only.

Toolbar button: Toolbar button. Keyboard shortcut: CTRL+SHIFT+F8.

Clear all breakpoints when fixed
 

Attachments

  • Capture.PNG
    Capture.PNG
    62.2 KB · Views: 364

inacio

Registered User.
Local time
Today, 23:49
Joined
Nov 15, 2017
Messages
12
In Debug, Step Into, etc and F8, etc are all grey. I still cannot access code.

In addition, I see now a new line ACWZTool above the name of the application and a reference to it in my application.

Sorry for being so stupid...
 

isladogs

MVP / VIP
Local time
Today, 21:49
Joined
Jan 14, 2017
Messages
18,246
I think you've somehow managed to open your database twice.
ACWZTool is inaccessible code used by the Access wizards.
That's why its greyed out

Close all instances of your database & reopen it ... ONCE!
You should no longer see ACWZTool.

Now carry on as previously instructed in your own database code which SHOULD be accessible
 

inacio

Registered User.
Local time
Today, 23:49
Joined
Nov 15, 2017
Messages
12
I feel bad because I am abusing your time and your patience. Please tell me when you are fed up with my problem.
I have done what you said and ACWZTool is gone, as you said.
And I started again ACCESS but to no avail. Step into, etc. are all greyed. I even tried to open other instances (copiesׂ) of the file. The behavior is always the same.
It is true that I have opened the database several times, and I mentioned it before. Apparently, almost all modules (or even all) are working. It's only the main default Switchboard screen that stops in the first line. See PrintScreen bellow. And sometimes it gives me a message: "The expression On Click you entered as the event property produced the following error: the expression you entered has a function name that Microsoft Access can't find".
The expression in that place is =HandleButtonClick(1) which is correct.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:49
Joined
May 7, 2009
Messages
19,247
you can also try to decompile your db

msaccess.exe /decompile
 

inacio

Registered User.
Local time
Today, 23:49
Joined
Nov 15, 2017
Messages
12
And then? If I decompile, how do I solve my problem?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:49
Joined
May 7, 2009
Messages
19,247
sonetimes it happens that codescan be misaligned and cannot be interpreted.
 

inacio

Registered User.
Local time
Today, 23:49
Joined
Nov 15, 2017
Messages
12
So, you suggest that decompile and compile it again?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:49
Joined
May 7, 2009
Messages
19,247
try running it in decompiled state.
 

isladogs

MVP / VIP
Local time
Today, 21:49
Joined
Jan 14, 2017
Messages
18,246
Don't worry about 'abusing my time'. I'll let you know when I've had enough on this. :)

Decompiling was also going to be my next suggestion.
If, as I suspect, that still doesn't fix it, the next suggestion is to create a new database then import all objects into that. If you do so, tick all the options before importing.

Two more questions.
I know you're using Access 2016.
32 bit or 64 bit?
Full version or runtime?

If you are happy to do so, zip and upload your database and I'll look at it.
My only concern is that you said it was in Hebrew which I'm not fluent in!!!!

BTW your image isn't uploaded properly so I can't view it
You have to zip attachments as you have less than 10 posts.
 

JHB

Have been here a while
Local time
Today, 22:49
Joined
Jun 17, 2012
Messages
7,732
Only for finding out if it is the button or something in the function, try change the number 1 to 2
Ex:
set it from =HandleButtonClick(1) to =HandleButtonClick(2) for the first menu item.
If that works then do the opposite for the second menu item.
set it from =HandleButtonClick(2) to =HandleButtonClick(1)
 

inacio

Registered User.
Local time
Today, 23:49
Joined
Nov 15, 2017
Messages
12
I tried to make the change as you suggested. However, when I try to close the table to experiment it, I am asked if I wish to save the changes. I answer yes and then it doesn't let me close the Switchboard table...
 

Users who are viewing this thread

Top Bottom