How to link a label control to textfield control when layout is tabular?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TjabbeTjibsma
    New Member
    • Nov 2013
    • 21

    How to link a label control to textfield control when layout is tabular?

    I want to be able to call the accompanying caption of a bounded text field control.

    When you have control and a label in a stacked layout, you can simply refer to your label using the .controls property:

    Me.SomeControl. Controls(0).Cap tion

    But when the using a tabular layout, the label does not seem to be linked anymore, i.e.:

    Me.SomeControl. Controls.Count will return 0

    Does anyone know how to reestablish a link or some other way around this?
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    At this time there is no work around for what you have been getting away with when refering to the associated label.

    Currently, (ACC2010 and earlier) In order for the textbox control to be placed in the details section and the label to be in the header, the association between the two must be broken.

    What I do is name the label and control as follows:[z_ctrl_txt_some name] and [z_ctrl_lbl_some name]

    if there is no control for a label then I name them according to section: [z_dtl_lbl_somed escriptivename], [z_hdr_lbl_somed escriptivename], or [z_ftr_lbl_somed escriptivename]

    When looping thru the form's control collection I filter on control type and instr() for the section or control.

    Comment

    • TjabbeTjibsma
      New Member
      • Nov 2013
      • 21

      #3
      Thanks for the (quick) reply!

      I considered your solution (which is entirely valid I think) but I decided to go a different route.

      I need the control field captions for an export to excel I'm doing. Since in my case some headers in the excel will need to be named (slightly) different than shown on the form, it was easier for me to store the 'excel headers' separately in the ControlTipText field.

      Comment

      Working...