[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

MS Access - Listbox values

Posted on 2002-04-03
4
Medium Priority
?
138 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

649 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