lilmikey1982
Registered User.
- Local time
- Today, 18:22
- Joined
- Jun 26, 2002
- Messages
- 14
Ey iye iye... my head hurts.
OK. So I have posted on this before, and I've kinda messed with it, but I have no idea what I've done wrong. What this does, is it makes a menu with 3 cascading combo boxes that will narrow down a table (in this case, a table of pictures), by categories. Now, it all works fine, untill I get to the last combo box. And then, I get a pop up window that says "Enter Paramter Value:" and then, above the imput text box, is the subject that I tried to select from the menu. Like, if I picked people form the third box, it would say people above the text imput box. And if, in the box, I type "People", the original subject I wanted, then it updates the table in the background (which is what I want it to do!), but then I get the same pop up box again, and if I type in the same subject again, I just get a VB error. Below is my coding... I'm just gonna go bang my head against a wall for a while. THANK YOU ALL SO MUCH!!!
Option Compare Database
Option Explicit
Private Sub cboColumnField_AfterUpdate()
Dim strSQL As String
Dim strSQLSF As String
cboNumericField = Null
strSQL = " SELECT DISTINCT tblDemo.NumericField FROM tblDemo "
strSQL = strSQL & " WHERE tblDemo.RowField = '" & cboRowField & "' And "
strSQL = strSQL & " tblDemo.ColumnField = '" & cboColumnField & "'"
strSQL = strSQL & " ORDER BY tblDemo.NumericField;"
cboNumericField.RowSource = strSQL
strSQLSF = " SELECT * FROM tblDemo "
strSQLSF = strSQLSF & " WHERE tblDemo.RowField = '" & cboRowField & "' And "
strSQLSF = strSQLSF & " tblDemo.ColumnField = '" & cboColumnField & "'"
Me!sfrmForm.LinkChildFields = ""
Me!sfrmForm.LinkMasterFields = ""
Me!sfrmForm.LinkChildFields = "RowField;ColumnField"
Me!sfrmForm.LinkMasterFields = "RowField;ColumnField"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cboNumericField_AfterUpdate()
Dim strSQLSF As String
strSQLSF = " SELECT * FROM tblDemo "
strSQLSF = strSQLSF & " WHERE tblDemo.RowField = '" & cboRowField & "' And "
strSQLSF = strSQLSF & " tblDemo.ColumnField = '" & cboColumnField & "' And "
strSQLSF = strSQLSF & " tblDemo.NumericField = " & cboNumericField
Me!sfrmForm.LinkChildFields = ""
Me!sfrmForm.LinkMasterFields = ""
Me!sfrmForm.LinkChildFields = "RowField;ColumnField;NumericField"
Me!sfrmForm.LinkMasterFields = "RowField;ColumnField;NumericField"
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.ColumnField FROM tblDemo "
strSQL = strSQL & " WHERE tblDemo.RowField = '" & cboRowField & "'"
strSQL = strSQL & " ORDER BY tblDemo.ColumnField;"
cboColumnField.RowSource = strSQL
strSQLSF = "SELECT * FROM tblDemo "
strSQLSF = strSQLSF & " WHERE tblDemo.RowField = '" & cboRowField & "'"
Me!sfrmForm.LinkChildFields = "RowField"
Me!sfrmForm.LinkMasterFields = "RowField"
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.RowField FROM tblDemo ORDER BY tblDemo.RowField;"
cboRowField.RowSource = strSQL
End Sub
OK. So I have posted on this before, and I've kinda messed with it, but I have no idea what I've done wrong. What this does, is it makes a menu with 3 cascading combo boxes that will narrow down a table (in this case, a table of pictures), by categories. Now, it all works fine, untill I get to the last combo box. And then, I get a pop up window that says "Enter Paramter Value:" and then, above the imput text box, is the subject that I tried to select from the menu. Like, if I picked people form the third box, it would say people above the text imput box. And if, in the box, I type "People", the original subject I wanted, then it updates the table in the background (which is what I want it to do!), but then I get the same pop up box again, and if I type in the same subject again, I just get a VB error. Below is my coding... I'm just gonna go bang my head against a wall for a while. THANK YOU ALL SO MUCH!!!
Option Compare Database
Option Explicit
Private Sub cboColumnField_AfterUpdate()
Dim strSQL As String
Dim strSQLSF As String
cboNumericField = Null
strSQL = " SELECT DISTINCT tblDemo.NumericField FROM tblDemo "
strSQL = strSQL & " WHERE tblDemo.RowField = '" & cboRowField & "' And "
strSQL = strSQL & " tblDemo.ColumnField = '" & cboColumnField & "'"
strSQL = strSQL & " ORDER BY tblDemo.NumericField;"
cboNumericField.RowSource = strSQL
strSQLSF = " SELECT * FROM tblDemo "
strSQLSF = strSQLSF & " WHERE tblDemo.RowField = '" & cboRowField & "' And "
strSQLSF = strSQLSF & " tblDemo.ColumnField = '" & cboColumnField & "'"
Me!sfrmForm.LinkChildFields = ""
Me!sfrmForm.LinkMasterFields = ""
Me!sfrmForm.LinkChildFields = "RowField;ColumnField"
Me!sfrmForm.LinkMasterFields = "RowField;ColumnField"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cboNumericField_AfterUpdate()
Dim strSQLSF As String
strSQLSF = " SELECT * FROM tblDemo "
strSQLSF = strSQLSF & " WHERE tblDemo.RowField = '" & cboRowField & "' And "
strSQLSF = strSQLSF & " tblDemo.ColumnField = '" & cboColumnField & "' And "
strSQLSF = strSQLSF & " tblDemo.NumericField = " & cboNumericField
Me!sfrmForm.LinkChildFields = ""
Me!sfrmForm.LinkMasterFields = ""
Me!sfrmForm.LinkChildFields = "RowField;ColumnField;NumericField"
Me!sfrmForm.LinkMasterFields = "RowField;ColumnField;NumericField"
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.ColumnField FROM tblDemo "
strSQL = strSQL & " WHERE tblDemo.RowField = '" & cboRowField & "'"
strSQL = strSQL & " ORDER BY tblDemo.ColumnField;"
cboColumnField.RowSource = strSQL
strSQLSF = "SELECT * FROM tblDemo "
strSQLSF = strSQLSF & " WHERE tblDemo.RowField = '" & cboRowField & "'"
Me!sfrmForm.LinkChildFields = "RowField"
Me!sfrmForm.LinkMasterFields = "RowField"
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.RowField FROM tblDemo ORDER BY tblDemo.RowField;"
cboRowField.RowSource = strSQL
End Sub