Using vba to combine two queries in Access
===

I have two combo boxes, Combo_A sets the query string in Combo_B. After selecting a choice from combo_B and hitting the go button, one of two queries is executed based on the selection in Combo_A. If choice 1 is selected in Combo_A then the go button executes query A and if choice 2 is selected in Combo_A then the go button executes query B.  This is all working great and it runs by assigning the query name to a variable and then executing with a DoCmd.OpenQuery_Click. 

My problem is that i want to take this one step further. I would like to cross reference the results from above with another query when a check box is selected, when not selected it needs to behave exactly the same as i currently have it designed. I know i can create the query but am less comfortable wokring with vba. Can i use the variable name that represend a query to join with another query? here is my vba code so far. 

    Option Compare Database



    Private Sub AgencyorCarrierSelection_AfterUpdate()
    If AgencyorCarrierSelection = "By Insurance Carrier" Then
        Combo7.Visible = True
        Text13.Value = "Select of of the following Carriers:"
        Text13.Visible = True
        Combo7.RowSource = "SELECT [tblRefInsuranceCarriers].[InsuranceCarrierID], [tblRefInsuranceCarriers].[CarrierName] FROM [tblRefInsuranceCarriers] ORDER BY [CarrierName];"
    Else
        Combo7.Visible = True
        Text13.Value = "Select of of the following Agencies:"
        Text13.Visible = True
        Combo7.RowSource = "SELECT [tblRefInsuranceAgencies].[InsuranceAgencyID], [tblRefInsuranceAgencies].[AgencyName] FROM [tblRefInsuranceAgencies] ORDER BY [AgencyName]"
    End If
    End Sub
    Private Sub lblSwitchboard_Click()
    DoCmd.OpenForm "switchboard", acNormal
    DoCmd.Close acForm, "frmInsuranceInformationConnect"
    End Sub
    Private Sub RunAgencyorCarrierQuery_Click()
    On Error GoTo Err_RunAgencyorCarrierQuery_Click

    Dim stDocName As String
    If AgencyorCarrierSelection = "By Insurance Carrier" Then
        stDocName = "qryInsuranceCarrierAgentPremiumBreakout_Carrier"
    Else
        stDocName = "qryInsuranceCarrierAgentPremiumBreakout_Agency"
    End If
    
    DoCmd.OpenQuery stDocName, acNormal, acEdit

    Exit_RunAgencyorCarrierQuery_Click:
    Exit Sub

    Err_RunAgencyorCarrierQuery_Click:
    MsgBox Err.Description
    Resume Exit_RunAgencyorCarrierQuery_Click
    
    End Sub
