P
Petitesouris
Hello,
I have a table for some products
tblErmax
Mark
Type
Designation
I have a form with cascading combos to be able to sort out my records
Mark
Type
Designation and below it brings the record that meet those criterias ...All
good until I select the Designation combo box...It bug and says it is missing
an operator I have tried everything and I am lost at tone stage before
mentioning the missing operator it was mentioning it had a problem with
distinct row on that last combo box designation
Thanks for the help!!!!!!!!!!!!!!!!!!!!!!!!!!!
Here is the code after update
Option Compare Database
Option Explicit
Private Sub cboDesignation_AfterUpdate()
Dim strSQLSF As String
strSQLSF = " SELECT * FROM tblErmax "
strSQLSF = strSQLSF & " WHERE tblErmax.Mark = '" & cboMark & "' And "
strSQLSF = strSQLSF & " tblErmax.Type = '" & cboType & "' And "
strSQLSF = strSQLSF & " tblErmax.Designation = " & cboDesignation
Me!ermaxForm.LinkChildFields = ""
Me!ermaxForm.LinkMasterFields = ""
Me!ermaxForm.LinkChildFields = "Mark;Type;Designation"
Me!ermaxForm.LinkMasterFields = "Mark;Type;Designation"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cboMark_AfterUpdate()
Dim strSQL As String
Dim strSQLSF As String
cboType = Null
cboDesignation = Null
strSQL = "SELECT DISTINCT tblErmax.Type FROM tblErmax "
strSQL = strSQL & " WHERE tblErmax.Mark = '" & cboMark & "'"
strSQL = strSQL & " ORDER BY tblErmax.Type;"
cboType.RowSource = strSQL
strSQLSF = "SELECT * FROM tblErmax "
strSQLSF = strSQLSF & " WHERE tblErmax.Mark = '" & cboMark & "'"
Me!ermaxForm.LinkChildFields = "Mark;Type;Designation"
Me!ermaxForm.LinkMasterFields = "Mark;Type;Designation"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cboType_AfterUpdate()
Dim strSQL As String
Dim strSQLSF As String
cboDesignation = Null
strSQL = " SELECT DISTINCT tblErmax.Designation FROM tblDemo "
strSQL = strSQL & " WHERE tblErmax.Mark = '" & cboMark & "' And "
strSQL = strSQL & " tblErmax.Type = '" & cboType & "'"
strSQL = strSQL & " ORDER BY tblErmax.Designation;"
cboDesignation.RowSource = strSQL
strSQLSF = " SELECT * FROM tblErmax "
strSQLSF = strSQLSF & " WHERE tblErmax.Mark = '" & cboMark & "' And "
strSQLSF = strSQLSF & " tblErmax.Type = '" & cboType & "'"
Me!ermaxForm.LinkChildFields = ""
Me!ermaxForm.LinkMasterFields = ""
Me!ermaxForm.LinkChildFields = "Mark;Type"
Me!ermaxForm.LinkMasterFields = "Mark;Type"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cmdShowAll_Click()
On Error GoTo err_cmdShowAll_Click
cboMark = Null
cboType = Null
cboDesignation = Null
Me!ermaxForm.LinkChildFields = ""
Me!ermaxForm.LinkMasterFields = ""
Me.RecordSource = "tblErmax"
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 tblErmax.Mark FROM tblErmax ORDER BY
tblErmax.Mark;"
cboMark.RowSource = strSQL
End Sub
I have a table for some products
tblErmax
Mark
Type
Designation
I have a form with cascading combos to be able to sort out my records
Mark
Type
Designation and below it brings the record that meet those criterias ...All
good until I select the Designation combo box...It bug and says it is missing
an operator I have tried everything and I am lost at tone stage before
mentioning the missing operator it was mentioning it had a problem with
distinct row on that last combo box designation
Thanks for the help!!!!!!!!!!!!!!!!!!!!!!!!!!!
Here is the code after update
Option Compare Database
Option Explicit
Private Sub cboDesignation_AfterUpdate()
Dim strSQLSF As String
strSQLSF = " SELECT * FROM tblErmax "
strSQLSF = strSQLSF & " WHERE tblErmax.Mark = '" & cboMark & "' And "
strSQLSF = strSQLSF & " tblErmax.Type = '" & cboType & "' And "
strSQLSF = strSQLSF & " tblErmax.Designation = " & cboDesignation
Me!ermaxForm.LinkChildFields = ""
Me!ermaxForm.LinkMasterFields = ""
Me!ermaxForm.LinkChildFields = "Mark;Type;Designation"
Me!ermaxForm.LinkMasterFields = "Mark;Type;Designation"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cboMark_AfterUpdate()
Dim strSQL As String
Dim strSQLSF As String
cboType = Null
cboDesignation = Null
strSQL = "SELECT DISTINCT tblErmax.Type FROM tblErmax "
strSQL = strSQL & " WHERE tblErmax.Mark = '" & cboMark & "'"
strSQL = strSQL & " ORDER BY tblErmax.Type;"
cboType.RowSource = strSQL
strSQLSF = "SELECT * FROM tblErmax "
strSQLSF = strSQLSF & " WHERE tblErmax.Mark = '" & cboMark & "'"
Me!ermaxForm.LinkChildFields = "Mark;Type;Designation"
Me!ermaxForm.LinkMasterFields = "Mark;Type;Designation"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cboType_AfterUpdate()
Dim strSQL As String
Dim strSQLSF As String
cboDesignation = Null
strSQL = " SELECT DISTINCT tblErmax.Designation FROM tblDemo "
strSQL = strSQL & " WHERE tblErmax.Mark = '" & cboMark & "' And "
strSQL = strSQL & " tblErmax.Type = '" & cboType & "'"
strSQL = strSQL & " ORDER BY tblErmax.Designation;"
cboDesignation.RowSource = strSQL
strSQLSF = " SELECT * FROM tblErmax "
strSQLSF = strSQLSF & " WHERE tblErmax.Mark = '" & cboMark & "' And "
strSQLSF = strSQLSF & " tblErmax.Type = '" & cboType & "'"
Me!ermaxForm.LinkChildFields = ""
Me!ermaxForm.LinkMasterFields = ""
Me!ermaxForm.LinkChildFields = "Mark;Type"
Me!ermaxForm.LinkMasterFields = "Mark;Type"
Me.RecordSource = strSQLSF
Me.Requery
End Sub
Private Sub cmdShowAll_Click()
On Error GoTo err_cmdShowAll_Click
cboMark = Null
cboType = Null
cboDesignation = Null
Me!ermaxForm.LinkChildFields = ""
Me!ermaxForm.LinkMasterFields = ""
Me.RecordSource = "tblErmax"
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 tblErmax.Mark FROM tblErmax ORDER BY
tblErmax.Mark;"
cboMark.RowSource = strSQL
End Sub