On Click Event Procedure Error

A

Adi

i'm getting an error message:
The expression On Click you entered as the even setting
property produced the following error: A problem occurred
while Microsoft Access was communicating with the OLE
server or ActiveX control.
*The expression may not result in the name of the macro,
the name of the user-defined function or [Event Procedure].
*There may have been an error evaluating the function,
event or macro.

now...what created this error...i made MS Wizard to create
a button for me...when ever i click it, it generates the
following error...in other words, any button with a vb
code generates this error...macros work fine but i cant
create 75 macros....
plz help me if possible
 
R

Ronald Dodge

I'm not really sure if this will help you, but I have ran into this sort of
issue from time to time within Access itself. I at times have typed in the
code manually, but then for some reason as I'm testing, I run into the same
type of error as you show before.

Two things that may help resolve this issue, first, make sure you don't have
duplicated private sub macros with the same name, and secondly, if the first
wasn't the case, you can try to click on the object in design-time mode,
then go into the properties, under the Event Tab, click on the Click Event,
then the 3 dots to the right of it, and it should take you to the code part
in VBA.

One other thing to be sure, there is no code within the parantheses on the
"Private Sub <ObjectName>_Click()" Line.
 
D

Dirk Goldgar

Adi said:
i'm getting an error message:
The expression On Click you entered as the even setting
property produced the following error: A problem occurred
while Microsoft Access was communicating with the OLE
server or ActiveX control.
*The expression may not result in the name of the macro,
the name of the user-defined function or [Event Procedure].
*There may have been an error evaluating the function,
event or macro.

now...what created this error...i made MS Wizard to create
a button for me...when ever i click it, it generates the
following error...in other words, any button with a vb
code generates this error...macros work fine but i cant
create 75 macros....
plz help me if possible

In addition to Ronald Dodge's suggestions, try opening the form's code
module in the VB editor and clicking Debug -> Compile <project>. There
may be syntax errors in other procedures within the module that are
preventing the module from being compiled. Even if there are no true
syntax errors, it's possible you have a broken reference that is
preventing compilation. In either case, compiling the project should
point you to the line(s) of code that are causing the problem.
 
R

Ronald Dodge

With regards to Dirk's suggestion on this issue, I didn't think about going
about it from that angle, but then guess that's also partially cause I do
from time to time compile my code. It's highly recommanded to do that,
which is one of the ways to help clean up your code. It doesn't catch all
errors, but it does have a higher catch percentage than the syntax checker.

The first version of my project is only about 60% developed at this point of
time, and already, I have pretty close to 11k lines of code. That is even
using programming rules such as code reuseability and scalability, but then
there's also a lot of things I had to code for just so as I can have the
best of both worlds (User friendliness and strict data validation checks).
Some of this coding deals with data validation checks in general, and some
deals with form behavior including up to this point of time, 3 different
class modules (Date Picker - Thanks to Leban for this tool, Measurement
Conversion - entirely my own creation, and an extension to Listboxes to
allow for drag and drop type feature, which is also entirely my own
creation, though a bit buggy due to how I had to go about it [bug specific
is well documented as to what causes it], but at least it works a good
majority of the time).

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000

Dirk Goldgar said:
Adi said:
i'm getting an error message:
The expression On Click you entered as the even setting
property produced the following error: A problem occurred
while Microsoft Access was communicating with the OLE
server or ActiveX control.
*The expression may not result in the name of the macro,
the name of the user-defined function or [Event Procedure].
*There may have been an error evaluating the function,
event or macro.

now...what created this error...i made MS Wizard to create
a button for me...when ever i click it, it generates the
following error...in other words, any button with a vb
code generates this error...macros work fine but i cant
create 75 macros....
plz help me if possible

In addition to Ronald Dodge's suggestions, try opening the form's code
module in the VB editor and clicking Debug -> Compile <project>. There
may be syntax errors in other procedures within the module that are
preventing the module from being compiled. Even if there are no true
syntax errors, it's possible you have a broken reference that is
preventing compilation. In either case, compiling the project should
point you to the line(s) of code that are causing the problem.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top