Hi there, I am new in VBA. I created a query from a table that lists several fields. Every time the query is used, it asks the user to enter the part number he/she wants to see and the quantity to print. I created a report from that query and it works fine. Once the user enters that information the report is printed/viewed. Instead of the user enter the information, I created a form with two combo boxes. So the user can select the part number from the combo box and the quantities from the other combo box. I can't connect the values from the combo boxes to the report. the report continues asking for the data. This is what I have so far. I removed the data from the quantity combo box for now. I am using Access 2010.
Code:
Private Sub OpenSPKanbanReport_Click()
On Error GoTo Err_OpenSPKanbanReport_Click
Dim stDocName As String
Dim strQueryName As String
Dim strPartNumber As String
stDocName = "BARCODE SP kanban report w_trigger"
strQueryPart = [PART_NO] = Forms![frmMain]![cboPartNumber]
strPartNumber = Me.cboPartNumber.Value
DoCmd.OpenReport stDocName, acPreview, "SP kanban query", strQueryPart
Or
DoCmd.OpenReport stDocName, acPreview, , strPartNumber
Exit_OpenSPKanbanReport_Click:
Exit Sub
Err_OpenSPKanbanReport_Click:
MsgBox Err.Description
Resume Exit_OpenSPKanbanReport_Click
Comment