[AccessD] How do I pass a control to a function in the Control Source

Max Wanadoo max.wanadoo at gmail.com
Tue Sep 29 15:42:59 CDT 2009


John,
Are you trying to do this with an event,  ie. Onclick,  onenter, onexit etc?

1. If so put the function call in the properties box
=GetTestResults(me.[Tag])

2. If not, you could try screen.active.control.value

3. Or send the control to a sub and call it from there.

This is air code. But I think 2 will work.

Max

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Skolits
Sent: 29 September 2009 21:13
To: accessd at databaseadvisors.com
Subject: [AccessD] How do I pass a control to a function in the Control
Source

I want to send a control object to a function from the ControlSource of a
text box.

I can send the Form object, but how about the control?

 

.

Example:
Let's say I want to send a control's tag to a function 
The name of the control is "txtFinalCalculation",
This in fact does work:
=GetTestResults([txtFinalCalculation].Tag)

The function retrieves the tag value with a function like: 
Function GetTestResults(strTagValue as string)

But I had to include the control's name in the original call. I want it
generic.

Something like:
=GetTestResults(ThisControl)

Then use the following function:
Function GetTestResults(ctlControl as control)

I've tried some things with "Active control " but that won't work.
There has to be a way to send the control's info to a function.
I can send the Form's properties: GetTestResults([Form]), but I want just
the individual control.

 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list