Solved

MS Access - Listbox values

Posted on 2002-04-03
4
132 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
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 49

Accepted Solution

by:
Ryan Chong earned 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Opening Remote & Local Data Connection 2 51
VBA color chart bars 12 77
Access 2013 combo box not working 3 38
Protecting vb6 & .Net code Obfuscation 18 94
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now