Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008
    Posts
    150

    Unanswered: Trying to get 2nd combo box to query off of the 1st combo box

    Hello Experts,

    I need assistance on requering two combo boxes.

    I have a combo box (cboProjNum) on my main form (frm_Orders) and another combo box (sbfcboOrderNum) on the same main form to filter on orders that are associated to the selected project.

    My combo box “cboProjNum” filters on specific records, which works great. The next step is to filter on the multiple orders that I have within a specific project. Right now the combo box for the proj num filters all the data I need to view on that specific project.

    After I receive my filter project information, I see in my order number combo box that the specific orders are there, but when I select on one of the orders the order information in the subform (sbf_orders ) does not filter. It does nothing.

    Please help! Thanking you in advance. :-)

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    In the cboProjNum_AFTERUPATE,
    the 2nd combo sbfcboOrderNum must be refreshed to read the cboProjNum. The sbfcboOrderNum query will have cboProjNum in its query as a parameter.
    Code:
    cboProjNum_AFTERUPDATE
       sbfcboOrderNum.requery
    cboProjNum.rowsource query = qsProjNums
    qsProjNums =
    select [ProjNum] from table where [project#] = forms!frm_Orders!cboProjNum

  3. #3
    Join Date
    Sep 2008
    Posts
    150
    Hello ranman256. Thank you for your response.

    I currently have the following code in the "AfterUpdate" event. How do I incorporate (if I can) the code you provided in the code that is currently in AfterUpdate? I am not code experienced, so please excuse me.

    I apologize, but I failed to mention that my two combo boxes are unbound. Not sure if this matters, but I thought I would mention it.

    Again I apprecate your time and help. :-)


    <Begin Code>
    Private Sub cboProjNum_AfterUpdate()
    On Error GoTo cboProjNum_AfterUpdate_Err

    DoCmd.SearchForRecord , "", acFirst, "[PA_NUMBER] = " & "'" & Screen.ActiveControl & "'"

    cboProjNum_AfterUpdate_Exit:
    Exit Sub
    cboProjNum_AfterUpdate_Err:
    MsgBox Error$
    Resume cboProjNum_AfterUpdate_Exit

    End Sub
    <End Code>

Posting Permissions

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