[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 139
  • Last Modified:

MS Access - Listbox values

Is it possible to save a users multiple selections in a listbox?  
I.E. I have a listbox with the following choices:
     Eastern
     Western
     Southern
     Northern

The multi-select property has been set to simple.

I want to be able to store the values selected by the user - so that when I return to the record, the users selections appear.

Thanks
0
debriggs
Asked:
debriggs
1 Solution
 
BahnassCommented:
if U Do it BOUND CONTROL ( ie set datasource,datafield Properties of normal combobox)

the dbase field will be integer saving index of combo
(ie 0,1,2,3)

U should then fill combo by programming (or even at design time in list property )

many other alternatives
1 use data combo with 2 tables
2 Do it all by prog (unbound control)

hope this helps
0
 
Ryan ChongCommented:
Example:

Public db As DAO.Database
Public rs1 As DAO.Recordset

In a Form:

.
.
FilterString = " Where "
        For i = 0 To ListBox.ListCount
            If ListBox.Selected(i) = True Then
                FilterString = FilterString & " IndChain.IndChain = '" & Replace$(ListBox.ItemData(i), "'", "''") & "' OR "
            End If
        Next i

If FilterString = " Where " Then MsgBox "No items selected.", vbExclamation, "Select Items to Search": Exit Sub Else FilterString = Left(FilterString, Len(FilterString) - 3)
        DoEvents
        temp = "SELECT DISTINCTROW Coy.CoyName " & _
               "FROM Coy INNER JOIN (IndChain INNER JOIN CustIndChain ON IndChain.IndChainID = CustIndChain.IndChainID) ON Coy.CoyID = CustIndChain.CoyID " & _
               FilterString & _
               " ORDER BY Coy.CoyName "
        Set db = CurrentDb()
        Set rs1 = db.OpenRecordset(temp)
       
.
.

Hope this help too
0
 
DanRollinsCommented:
Hi debriggs,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept ryancys's comment(s) as an answer.

debriggs, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
kodiakbearCommented:
Moving the Question to the PAQ

kb
Experts Exchange Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now