Multiple Selecton In ListBox

Sep 19, 2006

I create a list box to store a lsit of groups. It allows user to have multiple selections. I also have a "ALL" is the list. On listbox Click event, I then set up the SQL based on the selection. This SQL will be the query for the report.

If user select "ALL", I want all project to be selected. However, my code always show "SELECT * FROM tbFinancial_grouping
WHERE tbFinancial_grouping.RollUp IN('ALL');" Therefore, nothing is selected.

Could anyone et me know what is wrong about my code? Thank you very much.



Private Sub lsRollUp_Click()

Dim db As DAO.Database
Dim qdf1 As DAO.QueryDef
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL1 As String
Set db = CurrentDb()
Set qdf1 = db.QueryDefs("qry_FinancialReport_Selector")


For Each varItem In Me!lsRollUp.ItemsSelected
strCriteria = strCriteria & ",'" & Me!lsRollUp.ItemData(varItem) & "'"
Next varItem

If Len(strCriteria) = 0 Then
MsgBox "You did not select anything from the list" _
, vbExclamation, "Nothing to find!"
Exit Sub
End If


strCriteria = Right(strCriteria, Len(strCriteria) - 1)

If strCriteria = ALL Then

strSQL1 = "SELECT * FROM tbFinancial_grouping;"

Else

strSQL1 = "SELECT * FROM tbFinancial_grouping " & _
"WHERE tbFinancial_grouping.RollUp IN(" & strCriteria & ");"

End If

qdf1.sql = strSQL1

Set db = Nothing
Set qdf1 = Nothing

End Sub

View Replies


ADVERTISEMENT

Multiple Criteria Off A Listbox

Jun 8, 2007

I have a tutorial on how to do this, but they use an SQL code query. Is there anyway to do this by adding some type of criteria to an object query?

View 3 Replies View Related

Multiple Selection In Listbox

Jul 28, 2006

Hi

In my application, I am allowing multiple selection in a listbox.
The data is saved in table. While retrieving, the items that were selected for saving, show as selected. But on printing ListIndex, it prints -1. What could be wrong ? I need to resolve it. Any solution ?

View 1 Replies View Related

Multiple Select Listbox

Oct 6, 2006

Hi,
I tried putting a multiple select listbox in my access form but I cant put values in it. I want to put values of a table (i.e a field in the table) in the list.

I have selected the microsoft forms 2.0 listbox..
1> How can I put values in it?
2> Is there a way to make the access listbox a multiselect one?

Thanks

View 1 Replies View Related

Multiple Selections In A Listbox

Jul 11, 2006

I have a listbox with about 8 different choices. i want to be able to query what is selected in this list box but I need to be able to select more than one choice so that my employees don't have to create multiple forms for the same item. Is there any way to select more than one option? It would help greatly even if I have to add code in VB I will figure out how to do it, thank you.

View 2 Replies View Related

Multiple Selections From Listbox To Table

Apr 12, 2006

This must be pretty common but I cann't figure it out.

There is a listbox that multiple selections are allowed. This listbox is bounded with a table field. All selections must be stored. I don't mind if each selection is stored as a different record.

Any ideas?

View 13 Replies View Related

Multiple Listbox Selections Problem

Apr 13, 2005

Hi guys new here.

Here's what I'm trying to do:

I made a listbox in which get's it's source from a field in a table named Soft. The field is named Software1.

This field contains a list off software that could be installed on systems.
I allready can select multiple selections from the listbox but what I want to do is the following.

I want to press a button, and after I press the button I want that the selected Software is added to a new listbox which show the Software installed. The software in the second listbox would also be stored inside a Table so that I could print them out in Reports.

To simply explain what I'm trying to do:

SoftwareListbox >> Make multple selections>>Press button>> Adds selected software to InstalledListbox which stores in the softwarelist installed in a Table.

I really hope you guys understand what I'm trying to do.
And sorry for my bad english, should have paid better attention during English class ;)

View 11 Replies View Related

Saving Multiple Listbox Selections

Aug 29, 2005

Hi,

I have a simple order entry system working with a subform containing combo box where a client selects various products from a table. These are recorded in separate table which allows for subsequent updating of the orders placed.

Now I want to refine this so that the user may make multiple selections as it is a bit laborious making 'n' single selections via a combo based subform.

Only a list box allows multiple selections but I would like some guidance on how to store and be able to recall and update the selected items.

Thanks and Regards

Tony Randell

View 1 Replies View Related

NewBaby:Multiple Selection In ListBox!

Dec 15, 2005

I am designing a small database.
I have problem in selecting Mutiple list values from list box.

I have a table of Personal.With fields
SrNo ------------- autonumber
Name -------------- Text
Age ---------- Number
Interset ------------ (Text)
//In Interset Properties through lookup tag I have
Display Control -------ListBox
Row Source Type --------- Value List
Row Source ---------------- "Swimming","Football","Cricket",hockey"

When I made form I got all the List Box Items. For single Selection it has worked. But If I want Multiple selection. I changed the property List Box property Multi Select from "None" to Simple. Now It worked with Multiple Selection.But If one first record I select Swimming, Football.On second record it would be blank. And select my self. But the previous one is saved on all the next records.If two selction on first next all same selction with 2.
If three then three.

I want Individual selection. It must be saved.According to corresponding record.

Facillitate in this regard is much appreciated.

View 6 Replies View Related

Deleting Multiple Records In Listbox...?

Jul 6, 2006

hey all,
I'm using this code on a command button to delete single entries in a listbox... and it works fine
Private Sub DeleteMovie_Click()
CurrentDb.Execute "Delete from " & _
"tblMovies " & _
"where Title = """ & Me.lstList & """", dbFailOnError

Me.Requery
Me.lstList.Requery
Me.lstList = ""
End Sub
However, I want to try to select and delete multiple items in the list box. So I changed the property to allow multiple selections and now the button doesn't do anything when I click it. Ideally, I'd like the button to provide a "are you sure (yes or no)" prompt. Anyone know how to get this working? thanks a bunch

View 6 Replies View Related

Passing Multiple ListBox Selections To Subform

Sep 21, 2005

Using Access 2003.

I will have a ListBox on the form with “Multi Select” set to either simple or extended. I have a collection of documents which must be recorded in a database. Some documents may have only one author, but could have more. Same with the recipient or copied-to.

Ideally it would be nice to have the ListBox on the left, selected one or more from the list and then pass them to one of the three fields by a command button, sort of like:

cmdAuthorAuthor1
LISTBOXcmdRecipientsRecipient1; Recipient2
cmdCopiedTo Copy1; Copy2; Copy3

I would like to have all of the names selected from the ListBox as a string, but fully understand the problems associated with normalization. Other posts have suggested subforms. So, the question is how to select from the ListBox and then pass the possible multiple selections to discrete fields on a subform that would display, say three fields and which would get away from the normalization issues:

cmdAuthor [Author1] [ ] [ ]
LISTBOXcmdRecipients [Recipient1] [Recipient2] [ ]
cmdCopiedTo [Copy1] [Copy2] [Copy3]

The secondary issue will be that there will be subsequent names which are not found until actually in the process of document review which will create a need to update the ListBox, which I know is not akin to a ComboBox NotInList function.

If there are any thoughts or coding out there which will help, it’d be appreciated.
Lawguy

View 1 Replies View Related

Help In Insert/update Multiple Selection From A Listbox

Aug 7, 2005

thank you in advance for all your BIG help. :)

I have 3 tables - SMaster, SI_map, ILookup

I need to create a form to Add/Update into SMaster and SI_map tables, which has one-to-many relationship, that's why I use a list box to show the values from SI_map.

in SMaster [ Sid, other fields ]
in SI_map [ primary key, Sid, ILookupid ]
in ILookup [ ILookupid, IName ]

questions:
1. How to get the multi-selected values from the list box?
2. insert these multiple records into SI_map table at the same time with SMaster (if I use the same form to populate all these fields)
3. how to populate the records into form for user to see and update the values?

Any suggestion is appreciated, it is very flexible to change any format such as SMaster and SI_map can be separate forms, as long as it works.

Thank you.

View 3 Replies View Related

General :: Listbox Search By Multiple Letters

Aug 20, 2012

I'm using Access 2010, though am also familiar with Access 2007. I have a listbox populated with a query (concatenated last and first names with a bound ID field that's invisible). One of my users asked if it would be possible to search the listbox by more than the first letter of the name. As it stands now, if you type Smith, the focus would go to the first name starting with the letter "H", rather than Smith.

I've spent a lot of time researching this and come to the conclusion that this functionality does not exist within a listbox. However, I've discovered, a popular suggestion is to change the listbox to a combobox, which has this functionality. Since my listbox is multiselect, that would not work for me.

View 4 Replies View Related

Modules & VBA :: Remove Multiple Items From ListBox

Aug 6, 2013

I'm trying to setup a listbox so that multiple items may be selected and removed at once. The Listbox Multi Select property is currently set to "Extended" and I have the following code on the onclick event of a command button:

Code:

Private Sub Command12_Click()
Dim i As Integer
For i = List10.ListCount - 1 To 0 Step -1

[Code]....

I have tested selecting 4 or so records on the list box and then pushing the remove button but it seems that the only record that is removed is the selected record that is furthest down on the listbox. The other selected records become unselected and must be reselected in order to continue removing records.

View 1 Replies View Related

Modules & VBA :: Updating Multiple Items In A Listbox

Jan 9, 2014

In my form I have the listFunctions list box set to Multi Select "Extended" in the following code contains a line to execute a query based on the selected items in a listbox. but for some reason instead of only changing the selected items it is changing all items in the listbox. I stepped through the code and it is looping the correct number of times based on the amount selected but is still changing all.

eg.if I select 3 items from the list, it loops through the execute 3 times.but the total 6 items will change.

Code:

Private Sub cmdEdit_Click()
Dim varItm As Variant
Dim sSQL As String
Dim ssSQL As String

[code]...

View 1 Replies View Related

Forms :: Multiple Selection Listbox To Table

Jul 24, 2013

I have a form called "Record Call" when a user can input the calls that they have made or are scheduled. This form is based on the table "Call Records". I have created a new table called "CallAttendees" and added a listbox to my form for users to select who attended/participated in the call.

My code loops through the selections and writes these selections to the "CallAttendees" table. In this table i have an auto #, CallRecord, and Attendee fields. My code is supposed to write the "ID" field from the "Call Record" table to the "CallAttendees" table so that i can create the relationship between the two tables. However, this field is coming up blank since my form isn't generating the auto # until the record is closed.The tables are stored in a SQL server. I also tried saving the record prior to running my code.

View 5 Replies View Related

Forms :: Move Multiple Items In A Listbox

Jul 13, 2013

I have a form with a listbox in which users should be able to move the items up and down. The listbox has 4 columns and multiple selection is enabled.

For a NON multiselect box I have it working, and also for a multiple selection box but in that case it works only for one row at a time.

For a NON multiselect listbox:

Code:
cmdDown_Click()
Dim i As Integer
Dim t1 As String, t2 As String, t3 As String, t4 As String
i = selectie.ListIndex
t1 = Nz(selectie.Column(0, i))
t2 = Nz(selectie.Column(1, i))

[Code] ....

You can select an item and then press "Down" as many times as you want to put the items as "down" in the list as you want it to be.

Multiselect listbox

This code also works for a multipleselection listbox when one item is selected, however, after you press "down" the item is still selected (highlighted) as the code reselects is (last line) BUT the value of selectie.listindex apparently is set to "-1".

Pressing "Down" again generates an error (i = -1). I can evade the error by adding "if selectie.listindex <=0 then exit sub", but that doens't fix the problem that the only way I can manage to reset the listindex to the new "position" of the item is to click on it again and THEN press "Down".

To fix this and be able to press "down" multiple times listindex should be set to the new value.

Adding a "me.selectie.listindex = i -1" doens't work (error), it seems like this value is readonly.

I can't find a way to "simulate" a mousepressed selection and really set the listindex.

The other problem is of course that this code doens't support moving multiple items at once: listindex points to the last selected item, but only one.

So, I tried another piece of code to move multiple items, not using listindex (since that resets to -1), but I run into another problem

Code:
Private Sub cmdDown_Click()
Dim var As Variant
Dim i As Integer
Dim n As Integer
Dim t1 As String, t2 As String, t3 As String, t4 As String
n = Me.selectie.ItemsSelected.Count

[Code] ....

The problem with this is: I can select multiple items and press "Down", but the problem now is that the selection is lost as soon as the code removes the first item, and the 2nd loop skips the if selected(i) = true (nothing is selected anymore).
The me.selectie.selected(i+1) = true doens't work since that would only reselect the first item after moving it.

The code "forgets" which items were selected and moves only one item...So I guess I need to put the indexnumbers in memory while moving the items.

I have been searching a lot, but can only find VB-solutions. In VB it's a lot simpeler using f.e. the .list property of a listbox, which is not available in MSAccess

The solution I'm thinking about is:

- set an array with the numbers of selected items
- put indexnumbers of the selected items in the array (f.e. 3 and 4)
- move items based on the indexnumers in the array
- when moving an item update the indexnumber in the array (3>4, 4>5)
- after moving all items reset the selection based on the array

It occurred to me then if I'm going to use an array anyway, I might as well load all items in an array, do the "resorting" and the reload the items in the list from the array. Might be more straightforward?

Btw...It seems VB has a simple solution to moving items: listbox.list(i) = listbox.list(i+1) or something like that moves an item. Even Excel seems to have this property but not MS Access!

View 1 Replies View Related

Forms :: Remove Multiple Selected Items From Listbox

Jul 24, 2013

How do I remove multiple selected items from listbox.

Noticed it is a table/query listbox, not value list.

Remove selected.zip

View 1 Replies View Related

Queries :: Multiple Combo Boxes To Filter A Listbox

Jul 13, 2015

I have a form where I am trying to use 4 combo boxes(nomenclature,BPN,vendor, and reference) to filter a list box containing part numbers. The way I have it set up right now is in the listbox it is searching for each field and then in the criteria section i have [Forms]![myform]![respectedFieldsCombo].

This works when selections are made from the combo boxes but when one is blank (not being used to filter) then I assume it passes null for that value and the listbox doesn't return anything. I have tried to make it so the listbox ignores null values but im still having this problem.

For example: If i only have a selection for the vendor combo box then i want the list box to show all respective part numbers for that vendor, where nomenclature or any of the other fields are irrelevant. I also want to be able to stack these filters upon every new combo box selection.

View 7 Replies View Related

Modules & VBA :: Show Results From Multiple Tables In One Listbox

Aug 4, 2013

I have multiple tables (Desktops and Telephones)

A search form, to search into those tables (It searches by "User")

The search form contains a listbox that shows results (listPC)

And the following code:

Option Compare Database
Dim strUserPC As String, strUserTel As String
Dim db As DAO.Database, rsUserPC As DAO.Recordset ', rsUserTel As DAO.Recordset
Private Sub txtSearch_LostFocus()
strUserPC = ""
strUserTel = ""

[Code] .....

It works, but I have one problem. It only shows telephones or desktop, not both. It deppends on which line inside UpdateList is first.

That example searches into 2 tables:

-Telephones
-Desktops

And searches by "user".

I want to list all telephones and desktops that a user has assigned.

What should I change to show both results?

View 9 Replies View Related

General :: Multiple Values From Listbox In Textbox On A Report

Jan 17, 2015

Basically what I have is a form where a user has a drop down combo box that he can pick more than one value.

I then want to take what he has inputted e.g. Option1, Option2 and put that on a report in an unbound text box with another field value.

For example
=[Field1] & "/" & Option1/Option2

Those forward slashes are quite important as well, so any solution would need to include those.

View 2 Replies View Related

Modules & VBA :: Create Multiple Word Documents From ListBox MultiSelect?

Jul 31, 2013

I created a form with a ListBox and a Command Button. The users selects the values in the listbox and then click the button to create word documents. I've written VBA code to accomplish this. But it's not working properly. It opens multiple word documents but all for the same one.

Private Sub Command6_Click()
Dim appWord As Object
Dim varItem As Variant
Dim strPathToTemplateFile As String
Dim strPathToProspectiveFile As String
Dim strPreferredFileName As String
For Each varItem In Me.List0.ItemsSelected

[code].....

View 13 Replies View Related

Modules & VBA :: Listbox Setup With Option To Select Multiple Items

Jan 7, 2015

I am trying to set up a listbox with an option to select multiple items (I have done this and tested it with debug.print and it seems to work). I am then building a filter statement with VBA. I want to then use a button to add this statement to the filter in a subform with (a datasheet design), and then requery it.

My code below seems to be working in part. But I am getting all the items at times. Seems to work consistenly when selecting one item only, but I can't see anything wrong with my 'OR' statements when I debug.print.

Private Sub Command176_Click()
Dim i As Integer
Dim strFilter As String
Dim blnFirst As Boolean
i = 0
If Me.List163.ItemsSelected.Count = 0 Then

[Code] .....

View 3 Replies View Related

Queries :: ListBox Row Source Returning Multiple Blanks (Access 2007)

Jul 15, 2013

I have a list box on a form which uses the following SQL to pull the list items from a table :

SELECT DISTINCT tblMyTable.MyField FROM tblMyTable ORDER BY tblMyTable.MyField;

For some reason, during testing, the first two items on the list are blanks. I am quite happy for one blank to be returned at the top of the list (as this would easily identify for the user any records for which this field has not yet been completed, which is a good thing) but I can't understand why it would appear twice?

Why doesn't the DISTINCT command ensure any blank entries only appear once?

Incidentally, I have a subform which populates on the back of selections from the list boxes, so I can quickly see the corresponding records which generate these blanks. What's puzzling me is that the same records show for both blanks on the list - suggesting it is the same value repeating itself (and not, say, "" vs " ", for example, which was what I originally suspected...)

View 6 Replies View Related

Tables :: Unable To Insert Multiple Values Selected From Listbox To Database

Nov 19, 2012

i am trying to insert multiple values that i have selected in my listbox to my database access table when i click the "add record button" but the values does not appear in my database table.

i have 2 listbox, when i select the first list box(businessNature) it will display the records in the 2nd list box(lstCuisine). However, the records in the the lstCuisine list box is not entered into the table in my database.

(ps: in my property sheet for my lstCuisine listbox its multi select is simple)

Here is my codes:

Private Sub Add_Record_Click()
If IsNull(Name) = True Or IsNull(Mobile) = True Or IsNull(Email) = True Or IsNull(CompanyName) = True Or IsNull(BusinessNature) = True Then
MsgBox "Please fill in Business Nature, Name, Contact, Email and Company Name"
Else
DoCmd.GoToRecord , , acNewRec
End If
Dim conceptValue As String

[Code]...

View 10 Replies View Related

Register A Student To Multiple Classes (forms, Combobox, Checkbox, Listbox, Query)

Oct 7, 2005

Hello everyone,

I tried to post this yesterday but it didn't go through for some reasons.

I've attached my database that contains student, classes, and couple other tables. I also created couples of forms and I wanted to register a single student to multiple classes at once.

For example: There're 3 classes (Math, English, History) on 1/3/2006. Student A wants to register 2 classes, Math and English. I should be able to check those two and submit and I'm done.

Currently, I have to select Math and assigns to student A, then select English. That's not good at all. What if there're 10 classes in one day and a student just want to register 8 classes? I have to do eight times.

It'd be great if you could help me. Thank you in advance.
Isabel

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved