?
Solved

MS Access - Listbox values

Posted on 2002-04-03
4
Medium Priority
?
137 Views
Last Modified: 2010-05-02
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
Comment
Question by:debriggs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 3

Expert Comment

by:Bahnass
ID: 6916788
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
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 400 total points
ID: 6916877
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 7642909
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
 
LVL 1

Expert Comment

by:kodiakbear
ID: 7673545
Moving the Question to the PAQ

kb
Experts Exchange Moderator
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question