Multiple Multiselect Listboxes

Feb 18, 2006

Hi, my problems are numerous!
I have a form with a number of multiselect listboxes. Their sources are individual tables such as YEARS, PARISHES, CLIENTS. The underlying data is stored in a separate table. I want users to be able to select none, one or some values from each listbox and run a report.
As simple listboxes with one selection permitted this worked fine. I know that my problem is in concantenating the values.

I have tried attaching some code to the OnClick function of a cmd button on the form. I found this code referred to a number of times here and have tried to adapt it but no luck. I have now reduced my form to one listbox to test stuff out- this is the code-

Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim strSQL As String
Set frm = Form!testform
Set ctl = frm!lboparish
strSQL = "Select * from StJamesAgric where [Parish]="
For Each varItem In ctl.ItemsSelected
strSQL = strSQL & ctl.ItemData(varItem) & " OR [Parish]="
Next varItem

'Trim the end of strSQL
strSQL=left$(strSQL,len(strSQL)-300)

The first error I get is "can't find field 'testform'"

My form is called testform
The listbox is called lboparish
The table with all the data is called StJamesAgric

What am I doing wrong???? And also, if this code EVER works, do I need to repeat it for each listbox or do I insert refernces to each list box within just one subcommand?

Any help greatly appreciated.

Stella

View Replies


ADVERTISEMENT

Reports :: Filter Report Using 3 ListBoxes (MultiSelect)

Apr 16, 2015

My table "EmpTraining" will store 5 fields:ID (PK Autonumber )
EmpID (From Employees Table)
FleetName_ID ( From FleetList Table )
Engine1_ID (From EngineList Table )
Engine2_ID (From EngineList Table )

At the point of adding a record to EmpTraining table , EmpID and FleetName_ID and Engine1_ID are Required, Engine2_ID is optional.

I am having trouble generating a Report Filter that will use 3 Listboxes(multiselect) and be able to limit the report by what is selected.

My Listboxes filter:EmpBase (from Employees Table)
FleetName_ID ( From FleetList Table )
Engine1_ID (From EngineList Table )

I am trying to use the Third listbox to filter both Engine1_ID and Engine2_ID and I think this is my main problem.

On the Filter form that has the ListBoxes I use a button to apply the filter to the report, the code for this Onclick event is:

Code:
Private Sub btnApplyFilter_Click()
Dim varItem As Variant
Dim strBaseStation As String
Dim strFleetType As String
Dim strEngineType As String

[code]....

How can I also make it filter the Engine1_ID and Engine2_ID fields .?

Or Should I store the FleetName/Engine1/Engine2 in a different way?

View 3 Replies View Related

Combining Data From Multiple Listboxes?

Oct 4, 2012

I have created a DB who's sole purpose is to track employee availability and job positions available (a poor man's version of a scheduling database, if you will). I have 2 listboxes on one form. Listbox A shows all the employees available for work, and Listbox B shows the available work positions that require an employee. I am trying to create a functionality behind a button that will allow me to highlight one row in Listbox A and one row in Listbox B to combine the information in a seperate table (still not created) and refresh each Listbox to remove the entries. Similarly, I would also have to create functionality behind another button to undo the above, if needed.

View 1 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

ListBoxes Again

Mar 5, 2008

Hi,

i am looking for advice on listboxes. i have various books which all happily state everything exept how to use them!!

1st advice-

i need to know how to create an SQL statement on the listbox so it shows filtered dsata from a query. i am trying to filter by date so the list box could show multiple items carried out on the same date. is it:
SELECT Query.Field From Query Where Field

2nd advice-

a listbox shows data based on a query showing payments. i click on the payment in the listbox and a form opens with the specific data showing.
i have looked around but cannot find much on them.

help would be gratefully received as im currently stuck.


thanks,

NS

View 4 Replies View Related

Multiselect

Mar 31, 2005

Hi all

I have an unbound form. To the left I have a list box with a list of employee names. To the right I have a bunch of text fields. Once I've entered the data, I click on a button and it adds a new record. It works perfectly provided I add one employee at a time. It gets painful when I have multiple employees and I'm entering the same data.

Is there a way I can multiselect employees from the listbox, fill in the data fields and add multiple records which just one click??

I'd appreciate any advice.

View 4 Replies View Related

Dynamic Listboxes

Jul 17, 2005

Hello,

I have two tables: Categories and Subcategories.

Categories contains one field: CategoryName
Subcategories contains two fields: ParentCategoryName and SubcategoryName.

In a third talbe I want to select a category from a listbox, then have the subcategory listbox update automatically with the possiblities. Is this possible?

Thanks.

View 1 Replies View Related

Linking 2 Listboxes

Sep 1, 2007

Maybe somebody can help me with this... in my form I have two listboxes, first one to select the name of the client and the second one to select the contact person of the client... both are linked to a seperate table...

first listbox works fine, only the second one gives me troubles... in the source query I link the ClientID to the ID of the first listbox with...

Forms![PRODUCTIONS]![ClientID]

when I run the form, I get all the time a message window on my screen with the text Forms![PRODUCTIONS]![ClientID] and asking a value for it... I think that I do something wrong with getting the ID from the first listbox....

can somebody help me with this what to do ?

View 2 Replies View Related

Populating Listboxes

Feb 11, 2005

Hi,

Trying to populate a listbox using a .txt file created used WORD. This is the code i'm using:

Private Sub cmdDisplayFile_Click()
On Error GoTo text_open_error
Dim sTemp As String
Open "m:myaccessumber.txt" For Input As #1
Do While Not EOF(1)
MsgBox ("in loop")
Line Input #1, sTemp
lstShowTextFile.AddItem sTemp
Loop
Close #1

I'm getting nothing in the ListBox. Any hints would be much appreciated.
text_open_exit:
Exit Sub

text_open_error:
MsgBox Err.Description
Resume text_open_exit

View 2 Replies View Related

Hi! I Need Help With Comboboxes, Listboxes...

Dec 5, 2006

I have a form with many combo and list boxes, but i don't know how to find a relation between them. I want to select a name of a product that is in a combobox and then a list or text box will show its description.... Please help me because I will burn out sooner or later :eek:
KD:confused:

View 12 Replies View Related

Issue About Listboxes!

Oct 27, 2005

Hi
I have an Access form. I have a listbox that has the value pulled from a query. I also have a button on the form. When i click the button, the value from this listbox should be appended to a table. So I am trying to do this by referencing this listbox value as Forms!subform!listbox.value . This is storing the value of null. any idea of how to capture the value that is stored in a listbox.

Thanks
Neelima.

View 3 Replies View Related

Multi-MultiSelect With 'All'

Aug 27, 2005

Now i need some help here.
I adapted this code from somewhere on this forum. But iam having a problem with using the 'ALL' criteria.
It Opens a Report Dynamically from multiple selections in the two multiselect ListBoxes, but when i select 'All' and select any other item in another listbox
For Example(All in Names and Home1 in Homes) it gives me all the Results.
I have tried several criterias to solve it out but iam still failing.
Hope there will be help. Attached is a sample db in A2K and A97.
Thanks in Advance.

View 3 Replies View Related

Multiselect Search

Dec 25, 2004

Merry X-mas everyone!!!

I'm new to this message board and I'm glad i came across it. I've been looking for a way to multiselct search using Combo boxes.Reading through the threads here i found one (Posted by SBaxter). I've use the SQL Statements and VB code for my search. It works but not like his for some reason. The problem i'm having is when you open the form it asks for criteria like a parameter Query does. You have to type it in before it loads, unlike his where you click what you want out of combo boxes. At first i thought it was something i did wrong with the query but i've noticed that in his DB if you have the form open and then open the query it doesn't act like parameter. It does if the form is close. With mine that doesn't matter i still have to type it in! So i'm guessing it's with how i set up the list box in my form. I've attached a copy for someone to look at.




Thank.
RichM

View 5 Replies View Related

Multiselect Update

Dec 19, 2004

Hi all

I have a list box with a bunch of names in it that links to a subform on a master form. At the moment I click on a name and update details in the subform. It would be nice if I could multiselect names then update details all at once without having to individually change each one. I tried the multiselect property but I get index or relationship errors. I don't have any relationships (because I'm not adding new records... just updating) and I changed the indexes to NO. Didn't work. I tried!! Any idea how I might get this working??

I appreciate any advice.

Damon

View 13 Replies View Related

MultiSelect Listbox

Apr 19, 2005

I have a table, "people" which has all the main data stored. I have another table, "organizations" which I'd like to be able to use on a form to select which organizations people belong to. I created a button on my main form which opens another form on which a listbox with all the organizations shows. What I'd like to do is from the main form, click a button that brings up a new form. On the new form, I can select the affiliations. Then, when I close that form, a box on the main form shows what i've just selected. I got this to work with the listbox, but when I changed it to multi-select it stopped working. Help!! Thanks.

View 5 Replies View Related

MultiSelect ListBox

Jun 25, 2005

I want to be able to select multiple items from a listbox, click a button, and then print the data related to that item selected using a report.

In the report to print the data, I have added the criteria
[Forms]![Print Labels]![List2]
This is the name of the listbox. However, this doesn't print the items selected in the list box.

Do I have to do this through VBA, or can I accomplish this through a query in the report?

Thanks!

View 1 Replies View Related

Text Align ListBoxes

Jul 20, 2005

Is it possible to align text inside a multi column list box.
For example, currency field is always aligned to the left
where it should be right aligned.

Kappler

View 1 Replies View Related

Viewing Listboxes In A Report

Nov 19, 2005

Good Morning all,

On a Form I have a series of Listboxes, each drills down to a final piece of information. The Listboxes store a number_id which displays along with other information In this case the number_id is associated to a TEXT description. When I send the Listbox info to the Report it displays the info but the text doesn't wrap and it gets cut off. There is no "can grow" option on a list box.

So I need to create a Text Box in the Report but when I refrence the listbox in the control source only the number_id shows up. I need to see the associated text (field).

Any help would be great!

Thanks,

Phil "bones"

View 2 Replies View Related

Three Listboxes From Same Table Issue

Jun 14, 2006

hi guys, i was wondering if you can help me. I have a data entry form in which the user has three listboxes from an existing table (only one table for the three listboxes). however if the user selects the same item from listbox1 in listbox2 or listbox3, i want him to get an error message and don't let that happen. how can i do this? vba code?:confused:

this is my form:

Please select your three items of choice.

1st choice 2ndchoice 3rdchoice
listbox1 listbox2 listbox3


listbox1.value cannot equal listbox2.value and cannot equal listbox3.value.

View 5 Replies View Related

Scroll Bars In Listboxes

Jan 7, 2005

In the forms that I have made, none of the listboxes ever scroll with the mouse scroll wheel. I have tried to click into the listbox first to ascertain that the focus is in the listbox but nothing works. the only way to scroll is to manually drag the scroll bar tab.
I want to find out how i can make my scrolling work. I guess that there must be a global setting somewhere to switch it on or off... Any insight into this will be highly appreciated!

View 1 Replies View Related

Listboxes In Access For Beginners

Apr 10, 2006

I'm not a programmer by any stretch of the imagination. I'm having an issue I could use a little pro help with.

I have a listbox called "ListDIV" on a form called "fRptCriteria". I am trying to have a query called "qOpenOrds" look to the listbox for some parameters. The field on the query is called "DVNO2Y". The form also contains serveral Calendar Controls "SDate" and "EDate" that the query is looking at too.

In the past, I've had no difficulty referencing a Combo box, but the is listbox issue is driving me nuts!

Thanks in advance.....

View 5 Replies View Related

Search Form With Cbo And Listboxes

Mar 28, 2007

Hello,

I would like to create a search form with four combo and a listbox which would display the result of the combo.

All combos get data from Table1.

I would like to add:
cboSSN
CBOLNAME
CBOFNAME
CBODOB

When users will select a SSN, then CBOLNAME will return all records showing a the same Last Name with data SSN.

If users will select cboLNAME, then CBOFNAME will return all first names of the records with that specific Last name.

Is there a way I can do this or same example? Thanks.

View 1 Replies View Related

Dependent Listboxes With Criteria

Jan 11, 2015

I have a form that has two listboxes. The first list box is named "lstType", which pulls in information from a table tblType. The second or dependent listbox, named lstSName, is then filtered and only shows the SName that match the type. This is pulled in from a table "tblSName." Using the form filtering on the query "[Forms]![frmqryTask]![lstType]"

This portion actually works perfectly and filter my form as I wanted it too (at least originally). However, I realized a few days ago that the when clients or the SName does not have any active projects my company will be working on for them, we don't want don't need to see their name on the forms listbox called "lstSNameand", so we want change a status from "Active" to "Inactive". I've already added this status in as well.

What I'd like to have happen is that when using the dependent listbox, the lstSName will only show those with the "Active" status. I've tried adding the status = active onto the query, however I get a error message saying the query is too complex to run, which I'm guessing has something to do with the "[Forms]![frmqryTask]![lstType]" on the query.

View 9 Replies View Related

Toggle MultiSelect Property

Mar 10, 2006

Does any one know of a way to toggle a multiselect listbox's property programmatically?
The One In The VBS Help doesn't work!

View 5 Replies View Related

Multiselect Values In A Listbox

Jan 28, 2005

I was wondering whether it is possible to select multiple values in a list box on a form that can be stored in a table.

View 4 Replies View Related

Clear MultiSelect Listbox

May 21, 2007

I have a multiSelect Listbox that has email recipients. I have a command button with Me.emaillist = Null, and after I click the command button the Listbox is still highlighted in black. What VBA command do I create to completely clear the multiSelect Listbox, including the highlighted selection?

losstww

View 1 Replies View Related







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