Multiselect listboxs

deb

Active Member
Joined
Feb 1, 2003
Messages
400
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 <> "" Then
Call FillList
' Else
' Me!lblList.Caption = strMsg3
End If
End Sub

Private Sub cboChargeNo_AfterUpdate()
If Me!cboChargeNo.Value <> "" 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 <> "" Then
Call FillList
Else
Me!lblList.Caption = strMsg2
End If
End Sub

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

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

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

Private Sub Form_Activate()
If Me!cboFY.Value <> "" 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 = "Orders from " & _
Me!cboFY.Value & " for " & _
Me!cboCC.Column(1)
If Me!lstOrders.ListCount = 0 Then
Me!lblList.Caption = "No " & Me!lblList.Caption
End If
End Sub

I can send the mdb if needed.

Thanks in advance. This forum is a lifesaver.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
There is a Multi_Select option for List Boxes in Access 2002. I don't know if this option is available in earlier versions, but check in your list's Properties and see.
 
Upvote 0
Upvote 0
Maybe I am not explaining this well.

I know you cannot multiselect a combo box. I have known this for quite a while.

My post states: I have combo boxes and want to turn them into multiselect listboxes.

This code takes the many comboboxes and filters the results in a list box at the bottom of the form so the user can see the records before he prints the report. see below. This works great. But I have discovered that I need some of the combo boxes to be list boxes.

ComboBox Combobox Combobox 7 combos all together
Group Status FY
G11 Open FY0102
G12 Closed FY0203
G13 Rejected


One list box that displays the results of the user choices
Listbox
G11 Closed FY0203 abc123
G11 Closed FY0203 xyz123
G11 Closed FY0203 xyz789

and so on...

I now need to turn some on the listboxes into multiselect combos and I need it to work within the code I already have.

Please help
 
Upvote 0
Maybe I am not explaining this well.

My post states: In form design mode, right click the combo box and "change to" a list box.

In design mode, hold the mouse pointer over the combobox that you need to be a multiselect list box. Press the right mouse button. "Change to" is presented as a choice. Hold the mouse over the words "Change to." You are presented with an opportunity to hold the mouse over "List box" and click the left mouse button. Proceed as desired.

Perhaps your product version behaves differently. What version are you using?
 
Upvote 0

Forum statistics

Threads
1,223,477
Messages
6,172,481
Members
452,463
Latest member
Rigger4375

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top