Results 1 to 13 of 13
  1. #1
    Join Date
    Oct 2004
    Posts
    8

    Talking Unanswered: Display text on a form when condition is true

    Hi guys, can anyone help me with this? It should be simple but I keep going round in circles.

    All I want to do is display a label when a value in a field is over a certain amount. e.g. over 300

    It must use the visible property and test for true or false but where do i put the code? There are no event properties for a label. Am I going about it the wrong way. Someone showed me using macros and a text box with setvalue. Seems a bit long winded to me.

    Any thoughts?

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Um ... Let's see ...

    Private SomeTextBox_AfterUpdate()

    If SomeTextBox.Value > 300 Then SomeLabel.Visible=True

    End Sub

    Does this help clarify????
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Oct 2004
    Posts
    8

    Talking

    Private Sub Over_AfterUpdate()

    If Amount.Value > 300 Then Over.Visible = True

    End Sub


    Ive put this in the AfterUpdate event for the Over (unbound) control.

    Nothing happens. All i need to do is display a piece of text on the form which appears when the [AMOUNT]>300.

    I really thought what you'd suggested made sense and was surprised when nothing happend. I feel mega stupid as I think this should be an easy procedure. I've been using Access for a long time and still can't crack this one. Many thanks for your help though.

    Cheers

    Si

  4. #4
    Join Date
    Sep 2003
    Location
    Washington, DC
    Posts
    116
    Is your text box where you're entering the amount unbound?

  5. #5
    Join Date
    Oct 2004
    Posts
    8
    no it's a numeric field formated to currency

  6. #6
    Join Date
    Sep 2003
    Location
    Washington, DC
    Posts
    116
    When you enter a value is the information stored in the underlying table?

    Bound means that your control source property of the text box is bound to a field in the form's record source. If you look at the properties of that text box in question, you will see a value in the control source.

  7. #7
    Join Date
    Oct 2004
    Posts
    8
    yes when you enter an amount the control stores the value in the underlying table.

    I am currently trying to display an unbound text box with a simple border. this should appear and dissapear based on the amount field being under or over 300

  8. #8
    Join Date
    Sep 2003
    Location
    Washington, DC
    Posts
    116
    I believe your control has to be unbound in order for this to work. meaning the control source property cannot contain anything.

  9. #9
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by datura654
    Private Sub Over_AfterUpdate()

    If Amount.Value > 300 Then Over.Visible = True

    End Sub


    Ive put this in the AfterUpdate event for the Over (unbound) control.

    Nothing happens. All i need to do is display a piece of text on the form which appears when the [AMOUNT]>300.

    I really thought what you'd suggested made sense and was surprised when nothing happend. I feel mega stupid as I think this should be an easy procedure. I've been using Access for a long time and still can't crack this one. Many thanks for your help though.

    Cheers

    Si
    What is the "Over" control? A Label or a TextBox? You asked for help on a label ... Is the Over control hidden? Or is it a textbox that's empty? If so, then you need to do something like: Over.Value="Some Text Here" ...
    Back to Access ... ADO is not the way to go for speed ...

  10. #10
    Join Date
    Oct 2004
    Posts
    8

    Talking

    if i remove the link between the control and the table then the control will not store any values in the table? is that right.

    the control that I wish to hide/display is unbound already.

    i tried to do this with a label as well as a text box but as there are no event properties for a label this didnt seem to work.

    Currently the text box stays on screen regardless of the amount displayed in the amount field.

    perhaps i should just tell them I cant do it. Hey it is Friday after all.

  11. #11
    Join Date
    Sep 2003
    Location
    Washington, DC
    Posts
    116
    I feel your pain... Having similar issues with something I'm working on.

    The default visible property has to be set to no for the field you want to appear/disappear, and I believe you have to have the same statement in the Form_Current() as you do in the Control_AfterUpdate().

    Other than that I'm at a loss.

  12. #12
    Join Date
    Oct 2004
    Posts
    8

    Talking

    thanks anyway will keep you posted if i manage it

  13. #13
    Join Date
    Sep 2003
    Location
    Washington, DC
    Posts
    116
    keep an eye on my thread regarding enable field when check box = true. you should be able to replace ".enable" with ".visible" for your case. hope it helps!!

Posting Permissions

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