Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo Box (2000)

    I hate to be a pest but I am back again. Solve one problem and find another.
    I have a field on a form called Outcome. It has two options - Win or Loss
    I also have fields Primary Reason Win, Secondary Reason Win, Primary Reason Loss, Secondary Reason Loss.
    Those 4 fields are dropdown lists from 4 tables.
    My question is according to what is selected in the Outcome field (Win or Loss), instead of 4 dropdown lists, I would like to have only 2. If "Win" is chosen then have only the win list for both the Primary Reason and Secondary Reason and if Loss is selected have only the Loss reasons in the dropdown list for Primary Reason and Secondary reason. I would guess I could put 2 combo boxes on the form and then I am lost. What would I put for the control source etc
    Thank you for your help.

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box (2000)

    You could use an option box to choose between Win or Loss.
    According the option that is clicked, make the two according combo boxes visible and the other two invisible.
    Francois

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box (2000)

    That would be fine except I need the field that designates Win or Loss. Could I use the same logic with the dropdown list for outcome? Can I put the code behind the forms on current event. I would like it if they select Win then the 2 loss combo boxes disappear and if they select Loss the 2 win combo boxes disappear or am I way off base.

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo Box (2000)

    Yes this would be possible.
    You'll have to put the code in the On Current event of the form and also in the After Update event of your Win/Loss combo.
    Probably you'll have to add code to clear the fields of the invisible combo's if the user change from Win to Loss or vice versa.
    Francois

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

    Re: Combo Box (2000)

    <P ID="edit" class=small>(Edited by NYIntensity on 30-Jul-05 00:14. Edited to add example attachment.)</P>Linda, there are *many* ways you could do this...here's the one I would probably use:

    Create your Combo Box for Win/Lose (cboWinLose). Set Row source type to value list, for row source, type: "WIN";"LOSE"
    Create your combo box for Primary Reason (cboPrimary)
    Create your combo box for Secondary Reason (cboSecondary)

    Depending on how you populate your reason combo boxes, you will need to modify this code. If the reasons can be interchanged (I'm assuming they are), I would create a table named tblReasons, with two fields named WinLose and Reason. Obviously in the win lose column you will write WIN or LOSE, to identity if it is a reason for winning, or a reason for losing, and then the corresponding info in the reason field, ie:

    <table border=1><td>WinLose</td><td>Reason</td><td>Win</td><td>Our team is undefeatable</td><td>Win</td><td>Team communication was awesome</td><td>Lose</td><td>No team communication</td><td>Lose</td><td>Other team too good</td></table>

    Bind your combo boxes by right clicking and going to properties>data>
    Set Row Source Type = Table/Query
    Click on the [...] at the end of Row Source. View tblWinLose, and drag both fields into the query grid. For the criteria for the field WinLose, use =[Forms]![yourformname]![cboWinLose]

    In the After Update event of cboWinLose, use this

    Me.cboPrimary.Requery
    Me.cboSecondary.Requery
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

Posting Permissions

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