[AccessD] Using SET and Variable control names

Darryl Collins Darryl.Collins at coles.com.au
Thu Nov 13 22:04:01 CST 2008



Got it! :)

The exact syntax is

<For setting the form>
Dim frmTarget as Form
Set frmTarget = [Forms]![MyMainForm].[MySubForm].[Form]


<for using referencing variable controls on the form via code>
frmTarget("txt" & i & "_1_P" & n).ControlSource = "=" & dblValue
(where i and n are variables set in the code).

Got stuck as this is all down without the . between the form and control - (go figure).  Big thanks to Dev Ashish
http://www.mvps.org/access/forms/frm0003.htm

great stuff.  This is really starting to work nicely now :)

Thanks Drew.

Cheers
Darryl.


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Drew Wutka
Sent: Friday, 14 November 2008 2:59 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Using SET and Variable control names


Well the only thing I see wrong with the second part is you show two
different variables, one is getting the value you are making and one is
setting, but not that these two are the same.

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darryl
Collins
Sent: Thursday, November 13, 2008 8:52 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Using SET and Variable control names

OIC....  easy isn't it :)

thanks Drew.  Will keep working on the second part.  I thought it would
be simple as I do this sort of thing a lot in Excel VBA - very handy.

cheers
Darryl.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Drew Wutka
Sent: Friday, 14 November 2008 1:49 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Using SET and Variable control names


Ummm, to the first part, you have it backwards....

Set MyVariable = MyExistingObject

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darryl
Collins
Sent: Thursday, November 13, 2008 8:43 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Using SET and Variable control names

Hi folks,

Friday and brain is fading... urrrgh

I have a line of code like this

[Forms]![ITFCT_frmRptPeriodSummary].[ITFCT_frmRptSubPeriodSummary_Opex].
[Form].txt4_1_P1.ControlSource = "=" & dblValue

Firstly what I want is to make this nice and compact like this:

Set
[Forms]![ITFCT_frmRptPeriodSummary2].[ITFCT_frmRptSubPeriodSummary_Opex]
.[Form] as frmTarget

which I am struggling to get to work.  bah.

also the control I want to build up out of variables like this

i = 4
j = 1
k = 1

CtrlSrcName = "txt" & i & "_" & j & "_P" & k (= "txt4_1_P1")

and then use

frmTarget.CtrlSrcName.ControlSource = "=" & dblValue

That all seems nice in aircode but darned if I can get it to work.

any advice?

Cheers
Darryl.

This email and any attachments may contain privileged and confidential
information
and are intended for the named addressee only. If you have received this
e-mail in
error, please notify the sender and delete this e-mail immediately. Any
confidentiality, privilege or copyright is not waived or lost because
this e-mail
has been sent to you in error. It is your responsibility to check this
e-mail and
any attachments for viruses.  No warranty is made that this material is
free from
computer virus or any other defect or error.  Any loss/damage incurred
by using this
material is not the sender's responsibility.  The sender's entire
liability will be
limited to resupplying the material.


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
The information contained in this transmission is intended only for the
person or entity to which it is addressed and may contain II-VI
Proprietary and/or II-VI Business Sensitive material. If you are not the
intended recipient, please contact the sender immediately and destroy
the material in its entirety, whether electronic or hard copy. You are
notified that any review, retransmission, copying, disclosure,
dissemination, or other use of, or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited.


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

This email and any attachments may contain privileged and confidential
information
and are intended for the named addressee only. If you have received this
e-mail in
error, please notify the sender and delete this e-mail immediately. Any
confidentiality, privilege or copyright is not waived or lost because
this e-mail
has been sent to you in error. It is your responsibility to check this
e-mail and
any attachments for viruses.  No warranty is made that this material is
free from
computer virus or any other defect or error.  Any loss/damage incurred
by using this
material is not the sender's responsibility.  The sender's entire
liability will be
limited to resupplying the material.


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.


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

This email and any attachments may contain privileged and confidential information
and are intended for the named addressee only. If you have received this e-mail in
error, please notify the sender and delete this e-mail immediately. Any
confidentiality, privilege or copyright is not waived or lost because this e-mail
has been sent to you in error. It is your responsibility to check this e-mail and
any attachments for viruses.  No warranty is made that this material is free from
computer virus or any other defect or error.  Any loss/damage incurred by using this
material is not the sender's responsibility.  The sender's entire liability will be
limited to resupplying the material.





More information about the AccessD mailing list