C
cesemj
Hello,
I have three for combo boxes that I would like to use to limit the
results on a form. I am having trouble geeting them to work together.
I listed my code below and I think my problem is with the last section:
Form_frmRMISGeneral.RecordSource = LSQL3.
Thank you for your help in advance.
1) Two are used to caputure the Start and End Date form a calendar
control (LSQL & LSQL1)
2) LSQL2 is for the Ship Category
3) LSQL3 is for the the type of Ship in the Ship Category. I set the
after update to goto Sub Set Filter:
Private Sub cboShipTypeHull_AfterUpdate()
'Call subroutine to set filter based on selected Ship Class
SetFilter
End Sub
Sub SetFilter()
Dim LSQL As String
Dim LSQL1 As String
Dim LSQL2 As String
Dim LSQL3 As String
LSQL = "select * from qryMTTC"
LSQL1 = "select * from qryMTTC"
LSQL2 = "select * from qryMTTC"
LSQL3 = "select * from qryMTTC"
LSQL = LSQL & " where date_maintenance_action = '" & cboStartDate &
"'"
LSQL1 = LSQL1 & " where date_maintenance_action = '" & cboEndDate &
"'"
LSQL2 = LSQL2 & " where ship_class = '" & cboShipClass & "'"
LSQL3 = LSQL3 & " where ship_type_hull = '" & cboShipTypeHull & "'"
' Form_frmRMISGeneral.RecordSource = LSQL
' Form_frmRMISGeneral.RecordSource = LSQL1
' Form_frmRMISGeneral.RecordSource = LSQL2
Form_frmRMISGeneral.RecordSource = LSQL3
End Sub
I have three for combo boxes that I would like to use to limit the
results on a form. I am having trouble geeting them to work together.
I listed my code below and I think my problem is with the last section:
Form_frmRMISGeneral.RecordSource = LSQL3.
Thank you for your help in advance.
1) Two are used to caputure the Start and End Date form a calendar
control (LSQL & LSQL1)
2) LSQL2 is for the Ship Category
3) LSQL3 is for the the type of Ship in the Ship Category. I set the
after update to goto Sub Set Filter:
Private Sub cboShipTypeHull_AfterUpdate()
'Call subroutine to set filter based on selected Ship Class
SetFilter
End Sub
Sub SetFilter()
Dim LSQL As String
Dim LSQL1 As String
Dim LSQL2 As String
Dim LSQL3 As String
LSQL = "select * from qryMTTC"
LSQL1 = "select * from qryMTTC"
LSQL2 = "select * from qryMTTC"
LSQL3 = "select * from qryMTTC"
LSQL = LSQL & " where date_maintenance_action = '" & cboStartDate &
"'"
LSQL1 = LSQL1 & " where date_maintenance_action = '" & cboEndDate &
"'"
LSQL2 = LSQL2 & " where ship_class = '" & cboShipClass & "'"
LSQL3 = LSQL3 & " where ship_type_hull = '" & cboShipTypeHull & "'"
' Form_frmRMISGeneral.RecordSource = LSQL
' Form_frmRMISGeneral.RecordSource = LSQL1
' Form_frmRMISGeneral.RecordSource = LSQL2
Form_frmRMISGeneral.RecordSource = LSQL3
End Sub