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

Max Wanadoo max.wanadoo at gmail.com
Tue Sep 29 15:45:00 CDT 2009


> It allows for "light-weight" forms and creates nightmares for debugging.

Only if you get it wrong...here we go again, Charlotte LOL

I have never had a problem with it for over a decade of using it.  YMMV...

Max


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: 29 September 2009 21:37
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] How do I pass a control to a function in the
ControlSource

Where are you trying to send it from?  The control is a member of the
form's controls collection, so if you pass the control, it knows the
form that's its parent.  What you may be running into is the fact that
controls have specific properties and methods depending on the type of
control, but a simple control object has very few generic properties and
methods.

Why are you using properties sheet syntax for this?  It allows for
"light-weight" forms and creates nightmares for debugging.

Charlotte Foust

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

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

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