Results 1 to 6 of 6
  1. #1
    Star Lounger
    Join Date
    Nov 2002
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    change label caption (97)

    Hi. i would like to have a label caption change based on the value in the associated text box. the view is a continuous form. how can i do this? thanks. <img src=/S/surrender.gif border=0 alt=surrender width=31 height=23>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: change label caption (97)

    You can't do that with a label in a continuous form. If you change the caption, it will change for *all* visible instances of the label.
    Change the label into a text box, and set its control source to an expression that depends on the value of one or more fields. You can make it look like a label by making background and border transparent and by setting Locked to Yes and Enabled to No.

  3. #3
    Star Lounger
    Join Date
    Nov 2002
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: change label caption (97)

    Hi Hans. I keep getting a #Name? error. here is the expression i've typed into the control source of the unbound text box: IIf([clinic]=1,"frankston",""). what am i doing wrong??? thanks. Van <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: change label caption (97)

    Calculated expressions in the control source should begin with =

    =IIf([Clinic]=1,"Frankston","")

  5. #5
    Star Lounger
    Join Date
    Nov 2002
    Posts
    91
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: change label caption (97)

    <img src=/S/grin.gif border=0 alt=grin width=15 height=15> that's got it. thanks heaps Hans. Van

  6. #6
    Lounger
    Join Date
    Jan 2003
    Location
    Herndon, Virginia, USA
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: change label caption (97)

    Hi Van, you can use a text box and a DLookup to achieve the same effect. Set the text box to Enabled = No and Locked = Yes. You will need to do a requery in the AfterUpdate of the text box.

    Of course, the better approach might be to use a combo box if you know the range of possible values. You can create another text box and set its control source to "=cboComboBox.Column(1)". This assumes the value for the label is in the second column of the combo box (set the width of this column to 0). No need to do a requery with this method.

    The DLookup works well, but it's really slow if you have a lot of records in the continuous form. The Combo Box is probably the better approach.

    Brent

Posting Permissions

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