Puzzling On Click (go sub error)

splreece

Registered User.
Local time
Today, 03:23
Joined
Jun 2, 2016
Messages
40
Morning all,

I have finance package I have put together that includes calculated cells/onclick command buttons showing/hiding tabs and lots of commands running queries.

However nothing top programmatically complex.

The issue
If I open the dbase and userform for the first time and click on the show/hide command buttons I get the generic "the expression On Click you entered as the event...." (PLUS) the calculated fields don't work when first opened.

To fix. All the errors and fields clear, fix and start working if I just go into any of the code elements and then press f5. So I am assuming the normal load is cached or doesn't load all modules for some reason.

All fields work perfectly... after pressing f5 so I know that the fields aren't corrupt or creating errors however I am at a loss to how to find the issue or fix.

I have switched off caching through options but doesn't make a difference.

Any ideas???

I've tried opening a separate usermenu and using command buttons to open the form but that doesn't solve it.

Any ideas would be great.
 
What's in the On_Open event of the Form?
 
If things don't work the first time and you tell Access to continue - and it DOES - that suggests that maybe... just maybe - you have some sort of expression that tests a control that would be null on Form_Load but after it is used, everything becomes non-null. This is a wild-eyed guess on my part, but it smells highly of an initialization problem and having null values in some controls makes them not play well with others.
 
I have this occasionally and have never got to the bottom of it, I suspect the code tries to do something to something as the form loads but before it has configured a control.

Try compiling your VBA code, this normally works for me.
 
Do you have subforms? They load before the controls on the main form. The order they load isn't really controllable so it is possible to get initialisation problems with them.
 
In the event that I open the dbase and userform surprisingly and click on the appear/conceal order catches I get the bland "the expression On Click you entered as the occasion
 

Users who are viewing this thread

Back
Top Bottom