• command button, label, macro (2007, 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » command button, label, macro (2007, 2000)

    Author
    Topic
    #455975

    I am looking at a DBI downloaded from Microsoft and one of the forms (Attendees) has command buttons with associated labels. When I click on either the command button OR the associated label, the underlying event (macro or procedure) executes. Looking at the properties in design view, the action of the command button makes sense because there is an entry in the On Click event; however, the label has no such entry. So why does the macro or event procedure happen when the label is clicked?

    I see also that there is a text box control with a label – the control is set to not visible and the label is set to visible – in fact neither are visible on the form. When I set the control to visible then both are visible. It seems that when the control is set to visible then the label can be either visible or not visible. However, when the control is set to not visible, the label setting has no effect. Is this normal? I thought properties of labels and controls were independent.

    Viewing 1 reply thread
    Author
    Replies
    • #1137548

      This is interesting.

      Labels can be attached to another control or detached. When a label is attached, it inherits some of the properties of the control it is attached to. I think this explains both of these issues.

      You can recreate the command button behaviour as follows:

      • Create a command button with a picture on it.
      • create an ordinary label next to it.
      • Select the label, then cut it.
      • Select the command button then paste the label back onto the form
        [/list]The Label will now be attached to the command button, and will be clickable, but does not have its own event.
        When you select an attached label in Design view, it looks like this, indicating its attachment.
    • #1137550

      I have just thought of something else.
      Command buttons have an Auto Label property. If you set that to yes, in the default properties for command buttons, then new command buttons will be created with a clickable label.

    Viewing 1 reply thread
    Reply To: command button, label, macro (2007, 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: