I am still having problems debugging a the procedure below. I have tried setting a break point. My select-case is based on a combo box. How do I give the combo box a value OnChange in order for it to determine which items are suppose to be added to the next combo box? It only seems logical that the combo box needs a change to take place in order to execute the procedure, thus the Select portion.
Code:
Private Sub cboRptType_Change()
Select Case cboRptType.Value
Case "Pareto Chart"
cboConstraint.AddItem "Event Type"
cboConstraint.AddItem "Event Category"
cboConstraint.AddItem "Work Area/Cell"
'cboConValue.Enabled = False
'txtStartDate.Enabled = False
Case "RCA Event Report"
cboConstraint.AddItem "Work Order #"
cboConstraint.AddItem "Quality #"
'cboConValue.Enabled = True
'txtStartDate.Enabled = False
Case "RCA Event Summary List"
cboConstraint.AddItem "Specific Date to Present"
cboConstraint.AddItem "Work Area/Cell"
cboConstraint.AddItem "Event Type"
cboConstraint.AddItem "Event Category"
End Select
End Sub
Private Sub cboConstraint_Change()
Dim strEventSQL As String
Dim strSummarySQL As String
Dim strParetoSQL As String
Dim RstCount As Integer
Dim dtmStart As Date
Dim qdf As DAO.QueryDef
Me.txtStartDate.Text = dtmStart
strEventSQL , strSummarySQL, strParetoSQL, strConValue.RowSource = ""
Select Case cboRptType.Value
Case "RCA Event Summary List"
MsgBox "This option generates a Summary Report based on non-exclusive criteria. All records meeting this non-exclusive criteria will be displayed."
Select Case Me.cboConstraint.Value
Case "Specific Date to Present"
Me.txtStartDate.Visible = True
Me.cboConValue.BackColor = RGB(255, 255, 0)
Me.cboConValue.Text = "Multiple Records Report"
Me.cboConValue.Locked = True
strSummarySQL = "SELECT (*) FROM RCAData1 WHERE RCAData1.StartDate > '" & Me.txtStartDate.Value & "' ORDER BY RCAData1.DefectDate DESC;"
Case "Part Number"
strSummarySQL = "SELECT RCAData1.PartNo FROM RCAData1 ORDER BY RCAData1.DefectDate DESC;"
Me.cboConValue.RowSource = strSummarySQL
Me.cboConValue.Requery
Case "Work Area/Cell"
strSummarySQL = "SELECT DISTINCT RCAData1.AreaCell FROM RCAData1 ORDER BY RCAData1.AreaCell DESC;"
Me.cboConValue.RowSource = strSummarySQL
Me.cboConValue.Requery
Case "Event Type"
strSummarySQL = "SELECT DISTINCT RCAData1.Type FROM RCAData1 ORDER BY RCAData1.Type DESC;"
Me.cboConValue.RowSource = strSummarySQL
Me.cboConValue.Requery
Case "Event Category"
strSummarySQL = "SELECT DISTINCT RCAData1.Category FROM RCAData1 ORDER BY RCAData1.Category DESC;"
Me.cboConValue.RowSource = strSummarySQL
Me.cboConValue.Requery
End Select
Case "RCA Event Report"
Select Case Me.cboConstraint.Value
Case "Work Number #"
strEventSQL = "SELECT RCAData1.WorkOrderNo FROM RCAData1 ORDER BY RCAData1.DefectDate DESC;"
Me.cboConValue.RowSource = strEventSQL
Me.cboConValue.Requery
Case "Quality #"
strEventSQL = "SELECT RCAData1.QualityNo FROM RCAData1 ORDER BY RCAData1.DefectDate DESC;"
Me.cboConValue.RowSource = strConstraintSQL
Me.cboConValue.Requery
End Select
Case "Pareto Chart"
Select Case Me.cboConstraint.Value
Case "Work Area/Cell"
strParetoSQL = "SELECT RCAdata1.AreaCell, COUNT(*) as 'Number of Events' FROM RCAData1 GROUP BY RCAData1.AreaCell;"
Case "Event Type"
strParetoSQL = "SELECT RCAdata1.EventType, COUNT(*) as 'Number of Events' FROM RCAData1 GROUP BY RCADAta1.EventType;"
Case "Event Category"
strParetoSQL = "SELECT RCAdata1.Category, COUNT(*) as 'Number of Events' FROM RCAData1 GROUP BY RCAData1.Category;"
End Select
End Select
End Sub
I would really appreciate any advice, or maybe an explanation as to what is (and should be) going on. I feel that the further I get, the more I am in over my head.