Results 1 to 6 of 6
  1. #1
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    653

    To continue with the text box Label name property...get's deleted.

    I was playing with setting back the text box label name property which got deleted.
    Then I found that it gets cleared every time I move a label from the Detail section to the Page header section in a report.
    If I restore the label name in the text box, the label moves back down to the Detail section.


    Doesn't this seem a little odd? Or is there a reason it does this?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    reason is labels can only be related to controls in the same section

  3. #3
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    653
    Quote Originally Posted by CJ_London View Post
    reason is labels can only be related to controls in the same section
    Well, it would take the designer of Access report code to explain why, when it's so common, even in the wizard, to put labels in a different section than the text boxes. But doing that does make it impossible for coders to link the two when designing custom code to change or validate reports.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    when it's so common, even in the wizard,
    only for continuous forms, for datasheets the label is in the detail section

    But doing that does make it impossible for coders to link the two when designing custom code.
    no, not impossible but does require a workaround. There are a number of ways you can associate a label and textbox. Which is right will depend on of the requirement. You could associate on the left property or the tag property for a start. You can also use collections or dictionaries. Other ways is to have a standardised naming convention - lblPK, lblCustomerName as labels for txtPK, txtCustomerName, etc.

    Not much different using

    associatedlabelname=myControl.tag
    associatedlabelname="lbl" & mid(mycontrol.name,4)

    v

    associatedlabelname=mycontrol.controls(0).name

  5. #5
    twgonder is offline Expert
    Windows 10 Access 2016
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    653

    All true

    Quote Originally Posted by CJ_London View Post
    only for continuous forms, for datasheets the label is in the detail section
    no, not impossible but does require a workaround. There are a number of ways you can associate a label and textbox. Which is right will depend on of the requirement. You could associate on the left property or the tag property for a start. You can also use collections or dictionaries. Other ways is to have a standardised naming convention - lblPK, lblCustomerName as labels for txtPK, txtCustomerName, etc.
    Not much different using
    associatedlabelname=myControl.tag
    associatedlabelname="lbl" & mid(mycontrol.name,4)
    v
    associatedlabelname=mycontrol.controls(0).name
    All good observations, and made me wonder many years ago why Access didn't follow this simple naming convention in their wizards and when adding fields to forms and reports.

    Still, you gotta wonder why MS would break something like label name when moving to a different section. Questions like that often force one to think about what's going on inside the black-box, and then it goes into that big collection of intuition that sits in the dark corner of your brain.

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    why Access didn't follow this simple naming convention in their wizards
    I'm sure these is a good reason - personally I don't like naming the textbox the same as the control - can cause confusion in coding, hence my reason for renaming. But this is not unique to access, I certainly don't know them all by a long stretch but I have never come across a single FE development environment which does - often just a 'text1' type name or as part of the process you have to specify the name. As far as labels are concerned, they are just labels, I rarely rename those unless I have a specific reason to do so such as apply an event

    Access does 95% of what most developers require 'just like that'. You have to work for the other 5%. Yes, it could be better, anything could be better, but what is better for one person is worse for another. My naming convention works for me in the English language, not so good for Spanish, French and other languages.

    Still, you gotta wonder why MS would break something like label name when moving to a different section.
    it doesn't, it removes the relationship to a control

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 10-06-2019, 07:37 AM
  2. Restore deleted text
    By rosscortb in forum Access
    Replies: 3
    Last Post: 06-20-2019, 08:16 AM
  3. Replies: 3
    Last Post: 05-22-2019, 12:25 PM
  4. Replies: 7
    Last Post: 06-07-2018, 04:49 PM
  5. Replies: 2
    Last Post: 02-15-2015, 07:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums