Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multi select list box

Status
Not open for further replies.

auerd

Technical User
Oct 5, 2003
5
US
Multiselect listboxs
I am so close but yet soooo far...

I have a form with combo boxes which display the choices from the boxs in a list box.
If you choose from one of the 7 combo boxes it limits the display in the list box, if you choose another combo box, the listbox display is limited ever further...

It works great, buttttt

I need 4 of the combo boxes to be MULTIselect list boxes.
The boxes that are needed to be the combo boxes are (cboFY, cboCC, cboSigmaStatus and cboProjectType.

The code is as follows:

Option Compare Database
Option Explicit

Private Const strSQL1 = "SELECT FY, CC, ChargeNo, SigmaPlusNo, ProjectType, SigmaStatus, BeltName " & _
"FROM qProjectt WHERE FY like '"
Private Const strSQL2 = "' AND CC like '"
Private Const strSQL3 = "' AND BeltName like '"
Private Const strSQL4 = "' AND ChargeNo like '"
Private Const strSQL5 = "' AND ProjectType like '"
Private Const strSQL6 = "' AND SigmaPlusNo like '"
Private Const strSQL7 = "' AND SigmaStatus like '"
Private Const strSQL8 = "' Order by FY desc;"
Private strSQL As String

Private Const strMsg1 = "Select a product from the list"
Private Const strMsg2 = "Select a FY from the list"

Private Sub cboBeltName_AfterUpdate()
If Me!cboBeltName.Value <> &quot;&quot; Then
Call FillList
' Else
' Me!lblList.Caption = strMsg3
End If
End Sub

Private Sub cboChargeNo_AfterUpdate()
If Me!cboChargeNo.Value <> &quot;&quot; Then
Call FillList
' Else
' Me!lblList.Caption = strMsg3
End If
End Sub

Private Sub cboFY_AfterUpdate()
If Me!cboCC.Value > 0 Then
Call FillList
Else
Me!lblList.Caption = strMsg1
End If
End Sub

Private Sub cboCC_AfterUpdate()
If Me!cboFY.Value <> &quot;&quot; Then
Call FillList
Else
Me!lblList.Caption = strMsg2
End If
End Sub

Private Sub cboProjectType_AfterUpdate()
If Me!cboProjectType.Value <> &quot;&quot; Then
Call FillList
' Else
' Me!lblList.Caption = strMsg3
End If
End Sub

Private Sub cboSigmaPlusNo_AfterUpdate()
If Me!cboSigmaPlusNo.Value <> &quot;&quot; Then
Call FillList
' Else
' Me!lblList.Caption = strMsg3
End If
End Sub

Private Sub cboSigmaStatus_AfterUpdate()
If Me!cboSigmaStatus.Value <> &quot;&quot; Then
Call FillList
' Else
' Me!lblList.Caption = strMsg3
End If
End Sub

Private Sub Form_Activate()
If Me!cboFY.Value <> &quot;&quot; And Me!cboCC.Value > 0 Then
Call FillList
Else
Me!lblList.Caption = strMsg2
End If
End Sub

Private Sub FillList()
strSQL = strSQL1 & Me!cboFY.Value & _
strSQL2 & Me!cboCC.Value & _
strSQL3 & Me!cboBeltName.Value & _
strSQL4 & Me!cboChargeNo.Value & _
strSQL5 & Me!cboProjectType.Value & _
strSQL6 & Me!cboSigmaPlusNo.Value & _
strSQL7 & Me!cboSigmaStatus.Value & _
strSQL8
Me!lstOrders.RowSource = strSQL
Me!lstOrders.Requery
Me!lblList.Caption = &quot;Orders from &quot; & _
Me!cboFY.Value & &quot; for &quot; & _
Me!cboCC.Column(1)
If Me!lstOrders.ListCount = 0 Then
Me!lblList.Caption = &quot;No &quot; & Me!lblList.Caption
End If
End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top