Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    option box (Access 2000)

    On Open event of a report depending on the choice in Option box

    I have an option box called Office in the form called FBenchmark.
    In the OnOpen event of a report i want to have one record source in case that i have not selected something
    from the option box, and another set of conditions for the record source in case i have selected from the Option Box
    Which is the most professional way to do it?

    I have tried the following

    If Forms![FBenchmark]![office] = False Then

    Me.RecordSource = strSource1

    Else

    Me.RecordSource = strSource2

    end if


    It does not work.

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: option box (Access 2000)

    You mention option box. Do you mean option group? If you do mean option group then "Option groups" usually returned a number and you can provide an option group with a default value.

    " If Forms![FBenchmark]![office] = False "

    In the case of a default value, your code, which refers to the option group as equalling false, doesn't make sense, unless your default value is -1 (Minus 1).

    However, if you mean by "option box" a text box, then please could you provide a bit more information.

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

    Re: option box (Access 2000)

    What do you mean by "It doesn't work"? Any error message?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

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

    Re: option box (Access 2000)

    As Rupert pointed out, an option {b]group[/b] has a numeric value. It is possible to set one up with two buttons and return 0 or -1 as the value, depending on the button clicked. I've sometimes done this when I need to display two possible settings denoted by a yes/no field. However, it is more common to have an option group use 0 to denote no choice. If that's what you're trying to do, then you need to be sure that none of the buttons in the option group actually returns a 0 to be interpreted as a False condition.
    Charlotte

Posting Permissions

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