S
Sharon
I have two combo boxes:
the first is the cboReportType
the second is cboReportNumber
The first is based on a table with different types of reports: check
request, expense reimbursement request, travel reimbursement request,
purchase order request
The second combo box is based on a union query containing all report
numbers, i.e., expense report number, travel report number, check request
number, purchase order request number.
When I select the first combo box value, cboReportType, I want only the
records pertaining to that type of report to populate the second combo box.
I tried to modify the code that I found from Graham Seach. Can someone tell
me how to do this using a union query rather than a table? Or tell me what
else might be wrong with my code? Thanks.
Private Sub cboReportTypeName_AfterUpdate()
Dim sSQL As String
'This function sets the RowSource of cboReportNumber, based on the
'value selected in cboReportTypeName.
sSQL = "SELECT ReportNumber " _
& " FROM qryAllReports WHERE ReportNumber = " & Me.cboReportTypeName _
& " ORDER BY ReportNumber"
Me.cboReportNumber.RowSource = sSQL
the first is the cboReportType
the second is cboReportNumber
The first is based on a table with different types of reports: check
request, expense reimbursement request, travel reimbursement request,
purchase order request
The second combo box is based on a union query containing all report
numbers, i.e., expense report number, travel report number, check request
number, purchase order request number.
When I select the first combo box value, cboReportType, I want only the
records pertaining to that type of report to populate the second combo box.
I tried to modify the code that I found from Graham Seach. Can someone tell
me how to do this using a union query rather than a table? Or tell me what
else might be wrong with my code? Thanks.
Private Sub cboReportTypeName_AfterUpdate()
Dim sSQL As String
'This function sets the RowSource of cboReportNumber, based on the
'value selected in cboReportTypeName.
sSQL = "SELECT ReportNumber " _
& " FROM qryAllReports WHERE ReportNumber = " & Me.cboReportTypeName _
& " ORDER BY ReportNumber"
Me.cboReportNumber.RowSource = sSQL