Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Condition with VBA (2000)

    I have a Parts database. I've written about it many times, on a form I have synchronized combo boxes. I would like to add an addtion to that. The first combo box the user chooses the machine, the second CB will only show the vendors for the corresponding machine. I want to add to that second part where if [ysnCCOrder] is checked, only show the vendors that have that checked. I'm not sure how to write that in VBA. I already have the following code:

    Private Sub cboDPLSelect_Click()
    Me.cboVendorSelect.Requery 'my second combo box, cboDPLSelect is my first combo box
    End Sub

    Thanks,
    Deb

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

    Re: Condition with VBA (2000)

    I'm not sure I understand completely, so my reply may be off.

    It is probably best to change the row source of cboVendorSelect in the On Click or After Update event of cboDPLSelect.

    One way would be to set the row source to the appropriate SQL statement.

    Another way would be to have two queries, one that selects ALL vendors for the machine selected in cboDPLSelect, and another one that selects only vendors for that machine that have ysnCCOrder checked. Set the row source of cboVendorSelect to the name of the appropriate query.

  3. #3
    4 Star Lounger
    Join Date
    Oct 2002
    Location
    Sayre, Pennsylvania, USA
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Condition with VBA (2000)

    I think the SQL statement was the way I was trying to go, but I'm not that familiar and was having trouble getting it to work. Basically the way it works now is in another form I type in the parts to order for a particular machine and I add the vendor I'm ordering from. then I go to another form where I choose the machine (cboDPLSelect) then they choose the vendor to order from (cboVendorSelect) but this list will only show vendors that have orders for that particular machine. It works great. I now want to say, show me all the vendor with orders and that have ysnCCOrder checked.

    Thanks for your reply. I'll think through the queries.
    Deb

Posting Permissions

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