Attaching Labels to Objects on Microsoft® Access Forms and Reports
How to, in the design of forms and reports, attach and re-attach labels to text boxes, combo boxes, list boxes, etc.
Last updated on 2020-05-26 by David Wallis.
“David, Whilst working on the design of an Access database form I managed to delete the label attached to one of the text boxes. I know I can put a new label on the form, but it won’t be attached to the text box. Is there a way of doing this?”
Yes there is. It works for restoring a label to any control object on your form (or on a report), not just to a text box:
- Create the new label that you want to attach. I recommend giving your label an approtiate name that starts with your usual prefix identifying a label object
- Select the label
- Issue the Cut command
- Select the control to which you want to attach the label
- Issue the Paste command.
This technique should stick the label to the control and is applicable to Microsoft Access 97, 2000, 2002, 2003, 2007, 2010, 2013, 2016, 2019 and Microsoft 365.
Access 2019 introduced a new Label Name property that you can make use of instead of the cut-and-paste technique:
- Create the new label that you want to attach, and give it an appropriate name so that it’s easy to pick out from any list of controls
- Select the text box, list box or any other control to which you want this label associated
- From the Label Name property list, pick the label.
When you add a control such a text box to your form in its design view, Access furnishes that control with a label, as in this simple example:
If we switch the focus to the label itself …
… we can examine the properties of the label to learn that Access has assigned the value “Label6” to the Name property of the new label:
A default name such as Label6 doesn’t make it easy to relate that label to other control objects on a form. That’s why I consider it best to name such an object so that its identity and function are obvious to me. So, the value I assign to the Name property is made up of an appropriate name with a prefix that identifies the type of control.
In the image of the form above, consider text box that is bound to the InvoiceID field. I reckon tebInvoiceID would be a good name for it; and lblInvoiceID for the label to the left of it.
The Leszynski naming convention is what’s guided me through using names in this fashion. See Convention for Naming Objects in Microsoft Access Databases for details.
Your Support for dmw TIPS
If you’re going to make use of Tips in any of your professional or commercial work, then please consider making a payment in recognition of the time spent publishing this website, keeping it free of advertising.
To make a contribution by PayPal in GBP (£ sterling) —
To make a contribution by PayPal in USD ($ US) —
To say how much you want to pay and to receive
a tax invoice for a GBP (£ sterling) contribution —
Thanks, in anticipation.
DMW Consultancy Ltd does not accept any liability for loss or damage to data to which any techniques, methods or code included in this website are applied. Back up your data; test thoroughly before using on live data.