I do not know what is causing the error
Code:
Private Sub cboColumnField_AfterUpdate()
Dim strSQL As String
Dim strSQLSF As String
cboNumericField = Null
strSQL = " SELECT DISTINCT tblDemo.Exercise FROM tblDemo "
strSQL = strSQL & " WHERE tblDemo.Category = '" & cboRowField & "' And "
strSQL = strSQL & " tblDemo.SubCategory = '" & cboColumnField & "'"
strSQL = strSQL & " ORDER BY tblDemo.Exercise;"
cboNumericField.RowSource = strSQL
strSQLSF = " SELECT * FROM tblDemo "
strSQLSF = strSQLSF & " WHERE tblDemo.Category = '" & cboRowField & "' And "
strSQLSF = strSQLSF & " tblDemo.SubCategory = '" & cboColumnField & "'"
Me!sfrmForm.LinkChildFields = ""
Me!sfrmForm.LinkMasterFields = ""
Me!sfrmForm.LinkChildFields = "Category;SubCategory"
Me!sfrmForm.LinkMasterFields = "Category;SubCategory"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cboNumericField_AfterUpdate()
Dim strSQLSF As String
strSQLSF = " SELECT * FROM tblDemo "
strSQLSF = strSQLSF & " WHERE tblDemo.Category = '" & cboRowField & "' And "
strSQLSF = strSQLSF & " tblDemo.SubCategory = '" & cboColumnField & "' And "
strSQLSF = strSQLSF & " tblDemo.Exercise = " & cboNumericField
Me!sfrmForm.LinkChildFields = ""
Me!sfrmForm.LinkMasterFields = ""
Me!sfrmForm.LinkChildFields = "Category;SubCategory;Exercise"
Me!sfrmForm.LinkMasterFields = "Category;SubCategory;Exercise"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cboRowField_AfterUpdate()
Dim strSQL As String
Dim strSQLSF As String
cboColumnField = Null
cboNumericField = Null
strSQL = "SELECT DISTINCT tblDemo.SubCategory FROM tblDemo "
strSQL = strSQL & " WHERE tblDemo.Category = '" & cboRowField & "'"
strSQL = strSQL & " ORDER BY tblDemo.SubCategory;"
cboColumnField.RowSource = strSQL
strSQLSF = "SELECT * FROM tblDemo "
strSQLSF = strSQLSF & " WHERE tblDemo.Category = '" & cboRowField & "'"
Me!sfrmForm.LinkChildFields = "Category"
Me!sfrmForm.LinkMasterFields = "Category"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cmdShowAll_Click()
On Error GoTo err_cmdShowAll_Click
cboRowField = Null
cboColumnField = Null
cboNumericField = Null
Me!sfrmForm.LinkChildFields = ""
Me!sfrmForm.LinkMasterFields = ""
Me.RecordSource = "tblDemo"
Me.Requery
exit_cmdShowAll_Click:
Exit Sub
err_cmdShowAll_Click:
MsgBox Err.Description
Resume exit_cmdShowAll_Click
End Sub
Private Sub Form_Open(Cancel As Integer)
Dim strSQL As String
strSQL = " SELECT DISTINCT tblDemo.Category FROM tblDemo ORDER BY tblDemo.Category;"
cboRowField.RowSource = strSQL
End Sub