Expression Calling Public Function In Access 2007

  • Thread starter Thread starter RJGNOW
  • Start date Start date
R

RJGNOW

Hello Everyone,
I have a perfectly functioning db in 2000-02 and 03. On a calendar
form, that lives inside another form, I have all the day buttons OnClick
event tied to an expression that points to a public function in the
forms code container.

Looks like this =ClickMe(11).

Code Looks like this:

Public Sub ClickMe(ByVal iLabelNum As Integer)
DoCmd.Hourglass True
Me.Repaint
Call SelectDay(("lbl" & CStr(iLabelNum)))
DoCmd.Hourglass False
Exit Sub

In Access 2007 (either in 2002 or converted to 2007), I receive an
error: something about "The expression On Click you entered as the event
property setting produced the following error: The expression you
entered has a function name that (Program name) can't find."


Is this a bug or a "Feature" in Access 2007?


WBR
~Robert
 
I can't figure out how that could have worked in previous versions of
Access, since as far as I'm aware that syntax only works with functions, not
subs. (The function does not have to return a value)

What's the code for SelectDay?
 
Doug,
Oh man you are sharp. I have been staring at this problem a little to
long today. I didn't even notice that is was a sub... Changed it to a
function, and now all is good.... :-)

I guess Access 2007 corrected the "Loop Hole" in prev. versions.


Thank You!

WBR
~Robert
 
Back
Top