code in sub form wont run.

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

I have a button on each record of a sub form. The code in the on
click
event is very simple for now it just says

msgbox "testme"


but I get this error when I run it.


"This error occurs when an event has failed to run because Microsoft
Office Access cannot evaluate the location of the logic for the
event.
For example, if the OnOpen property of a form is set to =[Field],
this
error occurs because Access expects a macro or event name to run when
the event is fired."


The on click field in the properites says [Event Proceedure] like all
the others.


Is there something about this being on an unbound sub form that is
causing this problem?


Any other ideas?
 
Hi Michael,

Are you saying you entered

msgbox "testme"

in the actual line on the property sheet for the button? If so, it is going
to fail as it is expecting either "[Event Procedure]", a macro name,
"[Embedded Macro]", or an expression. If an expression it must start with an
equals sign. Now, MsgBox is a function, so it can be used as an expression.
So you could use:

=MsgBox("testme")

Clifford Bass
 
Back
Top