Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    command button, label, macro (2007, 2000)

    I am looking at a DB I 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.

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: command button, label, macro (2007, 2000)

    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:

    <UL><LI>Create a command button with a picture on it.
    <LI>create an ordinary label next to it.
    <LI>Select the label, then cut it.
    <LI>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.
    Attached Images Attached Images
    Regards
    John



  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: command button, label, macro (2007, 2000)

    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.
    Attached Images Attached Images
    Regards
    John



  4. #4
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: command button, label, macro (2007, 2000)

    Thanks. How do I get to the default properties for command buttons?

  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: command button, label, macro (2007, 2000)

    Don

    Look back at <post#=746,152>post 746,152</post#>

    John
    Regards
    John



  6. #6
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: command button, label, macro (2007, 2000)

    Got it. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •