Link to home
Start Free TrialLog in
Avatar of J2015
J2015

asked on

Entering expressions like "=SubroutineXYZ("lbl12")" instead of "[Event Procedure]" in Access' property sheet of form controls events, like OnClick

I've seen it done in Access 2000, but now I'm trying to do it in Access 2007 and it doesn't work. That would be very useful, for example, when a large group of buttons basically do the same thing, like in calendars for example.

Instead of using the Code Builder to generate a large number of Subs like these:

Sub cmdXY_Click()
   Call HandleButton(ButtonCoords:="XY")
End Sub

... I was able to simply write "=HandleButton("XY")" statements in the property sheet of their OnClick events. In Access 2007 I'm getting an error message "The expression you entered as the event property setting produced the following error: The expression you entered has a function name that Microsoft Access can't find.".

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of J2015
J2015

ASKER

I've requested that this question be closed as follows:

Accepted answer: 0 points for J2015's comment #a40864827

for the following reason:

My comment was a paraphrase.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
are you sure you want to accept your own post as the solution?
Avatar of J2015

ASKER

SouthMod/Capricorn1:

Sorry... I was not aware of the website's protocol. Now I understand why it's important to select the Expert's answer(s) as the solution: 1) to enable them to get points for their answers, 2) to buildup a knowledgebase of quality answers to questions.

Now, because Capricor1's initial answer triggered a corollary question (see comment ID: 40864849) I will wait before making a selection of a unique or multiple solutions. Therefore, this question remains open for now, unless that would break another rule.

J2015
Avatar of J2015

ASKER

I will post another question regarding "controls referencing themselves".