[AccessD] Using SET and Variable control names

Max Wanadoo max.wanadoo at gmail.com
Fri Nov 14 03:47:28 CST 2008


Darryl,
Something like this works:

  Dim frm As Form, ctl As Control
  Set frm = [Forms]![frmCreateBatchesFromExcel]
  Set ctl = frm![TxtTempTable]
  MsgBox ctl.Value

You might try playing around with the Eval() function to see if you can
somehow "macro" the expression you are building into an Object.

Max


On Fri, Nov 14, 2008 at 2:43 AM, Darryl Collins <Darryl.Collins at coles.com.au
> wrote:

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



More information about the AccessD mailing list