Error with .OnClick

A nice prefix of "bas" or "mdl" to your module name won't hurt ;)
 
A nice prefix of "bas" or "mdl" to your module name won't hurt ;)

Thanks for the tip, i'll definitely start doing that to avoid future problems.
 
Is the FormOpen function in a Standard Module or a Form Module? It needs to be in a STANDARD module with a name for the module different than the name of the function.
I don't think this one needs to be in a module. If I remember rightly it can be in the form module and can even be declared as Private. If I have time I will confirm that.
 
I don't think this one needs to be in a module. If I remember rightly it can be in the form module and can even be declared as Private. If I have time I will confirm that.

The REASON why it has to be in a standard module and not in a form module is anything in an EVENT PROPERTY and not in an actual event, can't see anything but public functions in a module. They can't even see public SUBS in a standard module. Just put in any function call into the event property and it won't work unless it is in a standard module. You can't even browse to one in the builder if it isn't.

And since we're setting that event property to a function, it has to follow the same rules as if you put it in there manually.
 
I thought I should create a little example for you. See attached.

Subs can't be used, but Functions are ok.
 

Attachments

I thought I should create a little example for you. See attached.

Subs can't be used, but Functions are ok.

Ok, you can do that in code and if you manually type it in (not using the builder). Must have done something in the past incorrectly which led me to that other conclusion. Good sample, thanks.
 

Users who are viewing this thread

Back
Top Bottom