Results 1 to 10 of 10
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    OnCurrent event (Access 2000)

    In the OnCurrent event of my form i have put a code trying to make the label visible
    only when the field TurnDown is True, but the code is somehow wrong.
    Why is my code not working ?


    If Me!TurnDown = True Then
    Me!LblTurnDown.Caption = "refusal"
    Else
    Me!LblTurnDown.Visible = False
    End If

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: OnCurrent event (Access 2000)

    You didn't make the label visible, you merely changed the caption!
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OnCurrent event (Access 2000)

    Yes, you are right.But the following code also does not work:
    If Me!TurnDown = True Then
    Me!LblTurnDown.Caption = "refusal"
    Else
    Me!LblTurnDown.Caption = "Pending"
    End If
    What is the reason ?

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

    Re: OnCurrent event (Access 2000)

    Have you set the Visible property of LblTurnDown to Yes in design view?

    Is TurnDown a Yes/No field?

  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: OnCurrent event (Access 2000)

    You say that this code does not work, but what actually happens?

    Do you see the lable at all? What caption does it display?

    Try putting in msgbox(Me!TurnDown ) to show you what value is being used for the test.
    Regards
    John



  6. #6
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OnCurrent event (Access 2000)

    Try:
    If Me!TurnDown = True Then
    Me.LblTurnDown.Caption = "refusal"
    Else
    Me.LblTurnDown.Caption = "Pending"
    End If


    To answer your original question, try:
    If Me!TurnDown = True Then
    Me.LblTurnDown.Visible = True
    Me.LblTurnDown.Caption = "refusal"
    Else
    Me.LblTurnDown.Visible = False
    End If
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What's more, you deserve to be hacked." -Richard Clarke

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: OnCurrent event (Access 2000)

    Look at what you're doing in code.

    Here, you're setting the label caption to "refusal" but not making the label visible:
    <hr>If Me!TurnDown = True Then
    Me!LblTurnDown.Caption = "refusal"<hr>

    Here, you're making the label invisible on if TurnDown is false and you aren't setting the caption:
    <hr>Else
    Me!LblTurnDown.Visible = False<hr>

    The net result is that if Turndown is true, you set a caption but you never make the label visible, so you can't see it anyhow. Try this:

    <code>Me!LblTurnDown.Caption = "refusal"

    If Me!TurnDown = True Then
    Me!LblTurnDown.Visible = True
    Else
    Me!LblTurnDown.Visible = False
    End If</code>
    Charlotte

  8. #8
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OnCurrent event (Access 2000)

    Thank you. I somehow cannot do it.I am sending the attachment in order to help me

    regards

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: OnCurrent event (Access 2000)

    The problem is that you have a continuous form, which means you can't use the technique described. Instead, you need to change the label to a textbox and change the controlsource of the textbox to an expression like this, including the equal sign at the beginning:

    =IIf([Turndown]=True,"refused","")

    I've attached a revised copy of your database.
    Charlotte

  10. #10
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Burgas, Bulgaria
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: OnCurrent event (Access 2000)

    Thank you very much indeed !!!!!

Posting Permissions

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