Expression Calling Public Function In Access 2007

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
 
D

Douglas J. Steele

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?
 
R

RJGNOW

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
 

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