Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2003
    Posts
    8

    Unanswered: Multiselect listboxs

    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 <> "" 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

    The mdb is attached

    Thanks in advance. This forum is a lifesaver.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Comboboxes by nature ARE NOT multiselect capable ... Unless you have a custom control ...

  3. #3
    Join Date
    Feb 2003
    Posts
    8
    Originally posted by M Owen
    Comboboxes by nature ARE NOT multiselect capable ... Unless you have a custom control ...

    I know combo boxes are not multiselect. That is why I need to convert 4 of the 7 combo boxes into multiselect listboxes. I need it to also display the data in the bottom list box.

    This form takes 7 combo boxes and kinda filters down the choices when items are selected from the combo boxes. It takes the filtered data and displays it at the botom on the form in the large list box.

    I need a little more flexability on 4 of the 7 combo boxes. That is why I need to have them changed into list boxes(multiselect)

    Please help,

    I am new and not very good at VBA.

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    I'm sorry. I should've read your post more carefully ... Well you'll need to convert the combos to listboxes and then populate them accordingly. The multiselect is easy ... It's a property of the listbox. Just check/toggle it.

  5. #5
    Join Date
    Feb 2003
    Posts
    8

    Unhappy

    The listbox is auto setup to return null unless there is code to make it do what you want.

    I don't know VBA well enough to do this and then populate the major listbox with the filtered results.

    Someone please help!!!

    If the mdb is needed I will forward it.


    thanks,

  6. #6
    Join Date
    Aug 2003
    Location
    SW Ohio
    Posts
    198

    Thumbs up

    Take a look at this link. Should be convertible to something like you want to do.

    http://www.dbforums.com/t926748.html
    Jim P.

    Supoorting Oracle, MSSQL7, Sybase 8, & Pervasive. Confusion Reigns

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •