Advertisement
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: |
Private Sub cmd_Var_Click()
'Variable to hold filtered SQL string
Dim strFilterSQL As String
strFilterSQL = "SELECT tbl_TotalSLT.PN, tblPN.Desc AS Description, tblPN.[P/S], tblPN.ABC, tbl_TotalSLT.[SD LTFCE]/tbl_TotalSLT.[Mean LTFCE] AS [Coeff of Var], tbl_TotalSLT.[Current LTFCE Inv], tbl_TotalSLT.[Holding LTFCE] FROM tblPN INNER JOIN tbl_TotalSLT ON tblPN.PN=tbl_TotalSLT.PN;"
If cmb_Planner3.Value <> "" Or cmb_PS3 <> "" Or cmb_ABC3 <> "" Then
strFilterSQL = strFilterSQL & " WHERE"
End If
If cmb_Planner3.Value <> "" Then
strFilterSQL = strFilterSQL & " tblPN.Planner = " & [cmb_Planner3.Value]'<------- BREAKS ON THIS LINE-----------
End If
If cmb_PS3.Value <> "" Or cmb_ABC3.Value <> "" Then
strFilterSQL = strFilterSQL & " AND"
End If
If cmb_PS3.Value <> "" And cmb_ABC3.Value <> "" Then
strFilterSQL = strFilterSQL & " P/S = " & [cmb_PS3.Value] & " ABC = " & [cmb_ABC3.Value]
ElseIf cmb_PS3.Value <> "" Then
strFilterSQL = strFilterSQL & " P/S = " & [cmb_PS3.Value]
ElseIf cmb_ABC3.Value <> "" Then
strFilterSQL = strFilterSQL & " ABC = " & [cmb_ABC.Value]
End If
If opt_SortBy = 1 Then
strFilterSQL = strFilterSQL & " ORDER BY COV [Coeff of Var] DESC"
ElseIf opt_SortBy = 2 Then
strFilterSQL = strFilterSQL & " ORDER BY [Holding LTFCE] DESC"
End If
strFilterSQL = strFilterSQL & ";"
Dim dbs As Database
Set dbs = DBEngine(0).Databases(0)
Dim qdf1 As DAO.QueryDef
Dim rst_Var As Recordset
Set qdf1 = dbs.CreateQueryDef("")
qdf1.SQL = strFilterSQL
Set rst_Var = qdf1.OpenRecordset()
If rst_Var.EOF = False Then
While Not rst_Var.EOF
lb_Var.AddItem rst_Var(0) '''get the required file
rst_Var.MoveNext
Wend
End If
rst_TotalSLTSubset.Close
qdf1.Close
dbs.Close
End Sub
|
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
|
Loading Advertisement... |