Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Hide Control (Access 2000)

    How do I make a control invisible using certain criteria, eg if customer is A, make visible. If customer is B hide. I've tried using the visible=true and visible=false command in code, but I can't be doing it right, or it's in the wrong place, but it does'nt work. Can anyone help. Cheers

    Rob

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

    Re: Hide Control (Access 2000)

    The syntax in code is

    If <condition> Then
    Me.MyControl.Visible = True
    ElseIF <condition> Then
    Me.Mycontrol.Visible = false
    End If

    This doesn't work on a continuous form because there is only one current record and all the displayed records reflect the same control settings. The OnCurrent event is the one to use.
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Hide Control (Access 2000)

    Thanks Charlotte. I looks as though its the OnCurrent one I need to use. Thanks again

  4. #4
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Hide Control (Access 2000)

    There doesn't seem to be a OnCurrent in the report. Also, in the condition, I've put a statement 'If Me.Customer like "ABC*" , obviousley with the customer name instead of ABC. How do I put Customer not like "ABC*". Not like does'nt work. Cheers.

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

    Re: Hide Control (Access 2000)

    You didn't mention that your question was about a report. Charlotte assumed that it was about a form. Use the On Format event of the section that contains the control you want to show/hide.

    The correct syntax for "not like" is

    If Not Me.Customer Like "ABC*"

Posting Permissions

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