On my form I have a button which the user can click. It will then prompt the user with 3 input boxes, where the user can enter in the information that he wants to run a query on. I want the query to run based on the values that he enters into the 3 inputboxes, but I cannot seem to figure this out. The query is based on another table in my database. Here is the code I've written. It won't compile because I have too many arguments. This is probably because I don't know how to pass variables with the DoCmd.OpenQuery command.
    Private Sub VariableQuery_Click()
    Dim strProdCode As String
    Dim strCampCode As String
    Dim strMailDate As String
    strProdCode = InputBox("Enter Product Code", "Product Code")
    strCampCode = InputBox("Enter Campaign Code", "Campaign Code")
    strMailDate = InputBox("Enter Mail Date", "Mail Date")
    DoCmd.OpenQuery "contribution", , , "[PRODUCT_CODE]=" & strProdCode & _
    "[CAMPAIGN_CODE]=" & strCampCode & "[MAIL_DATE]=" & strMailDate
    End Sub
Any help is appreciated. The name of the query I am trying to run is "contribution". PRODUCT_CODE, CAMPAIGN_CODE, and MAIL_DATE are the names of the fields in the database and PRODUCT_CODE and CAMPAIGN_CODE are both text fields, and MAIL_DATE is a Date/Time field.
 
     
     
    