Forms :: Filter Queries By Listbox Selection?

May 31, 2013

I am currently working on a form for my users to look at budget data. I have several listboxes for them to filter queries by. What I was wondering is, if it is possible to have data in one list box be filtered by the preceeding listbox?

For example: Three list boxes: Report_Period, Budget, Dept.

Each list contains all the values possible. This data is all in a filter table (and the listboxes created using SELECT DISTINCT queries to that table for the specific field). So, if I select Budget XYZ, could I filter the Dept listbox to only show the dept.'s associated with that budget? These are all multi-select listboxes by the way, so budget ABC and XYZ would only show the departments associated as well.

View Replies


ADVERTISEMENT

Forms :: Filter A Report Based On Listbox Selection - Apostrophe In Results

Feb 17, 2014

I use the follwing code to filter a report based on the listbox selection on a form. Below is the code I use, the problem it will error if the results have an apostrophe in the string.

Private Sub FilterDesc_Click()
Dim strWhere As String
Dim ctl As Control
Dim varItem As Variant
'make sure a selection has been made
If Me.ListCarrier.ItemsSelected.Count = 0 Then
MsgBox "Must select at least 1 Carrier"

[Code] ....

View 7 Replies View Related

Forms :: Make Listbox Visible After Selection Of Another Listbox

Oct 23, 2013

Okay then, after much trouble and confusion, I finally realized I need to use an Extended listbox in order to allow for multiple items to be selected from a list on my form (rather than the evil multiple selection combobox!).

However, now I am trying to figure out how to make one listbox (IndustryClassification) only be visible if the item "Industry" is selected in another listbox (TypeOfBusiness). Coding I can use for this in the AfterUpdate event of the listbox?

View 7 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 :: Listbox Selection Based On A Table

Jul 18, 2014

I have a form with a listbox that allowed multiselection.

The listbox depends on the field "name"

And I have a table "names_should_be_selected" (fields: name, date ...)

It would be great if alle names in the listbox are selected when the name is in the table "names_should_be_selected".

View 3 Replies View Related

Forms :: Running A Query Based Upon A Listbox Selection?

May 1, 2015

I have a list box that is correctly listing resources from a table (tblResource). I would like to select one of the list box entry and run a query against the tblResource to show the information for that resource in a form. I have tried to use the lstindex with the control (lstResource) in the where clause of a query to accomplish this with no success.

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

Queries :: Listbox Filter Not Returning Empty Values

Jun 14, 2013

I have a form in which users can enter data in several textboxes to filter the listbox below it, this works great except for the fact that when a record lacks certain data it doesn't show up

Basically there are 4 filters, one for the name/id which works great, as the entries without id's show up just fine but this filter needs to be checked against the other 3 filters, for their group, education and type.

Lets use group as an example.

When a student has no group it should only show up when the group filter is an empty string. AFAIK the wildcards should see to that.

Currently however, when a student has no group, it doesnt show up at all unless I remove the | Like '*' & [groepFilter] & '*' | part from the query.

I've never used complicated WHERE's like this so it might be something very simple. I think I could get it to work using VBA and modifying the rowsource of the listbox from there but this would be a lot easier and I'm curious as to why this doesn't work.

The SQL:

SELECT Student.Studentindex, Student.studentid, Student.studentvn, Student.studenttv,
Student.studentan, Student.Groepcode, Opleiding.opleidingsnaam, Opleiding.type
FROM Student LEFT JOIN Opleiding ON Student.opleidingid = Opleiding.opleidingid
WHERE (((Student.studentid) Like '*' & [naamFilter] & '*') AND ((Student.Groepcode) Like '*' & [groepFilter] & '*')

[Code] ....

View 2 Replies View Related

Queries :: Listbox Returns Empty Before Applying Filter

Jul 14, 2015

I am using two combo boxes to filter a list box with the code below. The combo boxes work, but when the form opens, the list box is empty until it is filtered using the combo boxes.

I want the list box to return all records when no filter is applied.

Here is the code:

SELECT Q_Gender_Statistics.ParticipantID, Q_Gender_Statistics.Gender, Q_Gender_Statistics.Date,
Q_Gender_Statistics.Year, Q_Gender_Statistics.[First Name], Q_Gender_Statistics.[Last Name],
Q_Gender_Statistics.[Other Names], Q_Gender_Statistics.[Passport No], Q_Gender_Statistics.[Duty Station], Q_Gender_Statistics.[Contact Number] FROM Q_Gender_Statistics WHERE (((Q_Gender_Statistics.Year) = Forms!F_Gender_Statistics!cboYear) AND ((Q_Gender_Statistics.Gender) = Forms!F_Gender_Statistics!cboGender)) ORDER BY Q_Gender_Statistics.Date DESC;

View 4 Replies View Related

Forms :: Listbox To Filter For Query

May 13, 2014

Now I have coded what I think should work for my listboxes and it does not. When I click it does nothing. No processing of anything.

I have 11 multi-listboxes and want to collect what the user selects from each one and then use it to run my query. The query only uses 4 of the listbox items and then 4 other items that I have in the query. I want to be able to display this in the same form or perhaps a subform. Here is my code:

Code:
Private Sub command8_click()
' Update the record source
If BuildFilter = "" Then
Me.frmQual_Sub.Form.RecordSource = "select * from qualq1 where " & BuildFilter
End If

[Code] .....

View 2 Replies View Related

Forms :: Filter Listbox By Checkboxes

Jul 26, 2013

I wish to filter the records in a listbox by using checkboxes.

The listbox (list1) and the checkboxes are in the same form (form1)

The listbox displays the records from a query (query1) related to a single table (table1).

Each record (assuming a list of videos) has a field called "Typology". The "video typologies" are: Movie, Documentary, Animation. So the table1 has a column called "Typology" which displays one of the three typology in simple text.

When entering a new record (in a specific form) user can choose the typology selecting an option in a combobox. The combobox is a "value list" one and I wrote the typologies in the "row origin" line:
"Movie";"Documentary";"Animation"

So we have a single column in simple text for all the typologies, but limited choiches.

So far everything is working well.

Now I wish to filter the records in the listbox by typology. Each typology should be related to a checkbox, so when I check a checkbox then the listbox returns only the records form a specific typology. Also, I wish to check more then one checkbox in order to display records from multiple typologies rather than one.

I've already made a button which resets the form, displaying once again all the records and eventually unchecking all the checkboxes.

About option buttons: I've managed filtering the listbox results using option buttons in a frame (option group?) and it works fine, but in this way I can choose only one typology at a time (and the typology field in the tabel1 of course is not simple text, but numeric: 1=Movie, 2=Documentary etc).

I thought this could be solved using the click event on each checkbox:

-If the checkbox "Movie" is checked then the listbox shows only the records which have the text "Movie" in the Typology field. Else, show all the records.
-If the checkbox "Documentary" is checked then the listbox shows only the records which have the text "Documentary" in the Typology field.
Etc......

View 11 Replies View Related

Reports :: Forms With Listbox To Filter Report

Feb 24, 2014

I have a report on this report there is a Destination City field and a Current City field, loaded from a table. I have a command button that loads a form to filter on the destination city, I have another command button that loads a form to filter on the current city location.

What I would like is, when I use the form to filter the destination city, then load the form to filter on current city, I want the listbox on the form for the current city to only list cities that are associated with that destination. Both form listboxes have the rowsource from the same table, just different fields. Is this possible?

View 7 Replies View Related

Forms :: Date Selection On Form - Filter Records Based On ID

Feb 15, 2015

I have been building a database for use in a charity shop and am struggling with an issue regarding one of the forms.

I currently have a form which displays all expenses from the shop. I have added a combo box to the top of this form which allows users to filter records based on an expense ID Code. It all works fine but I would like to be able to add a start date and end date box to the form also so that records can be shown between two dates.

I have tried adding parameter boxes to the query which runs the form (which works) but the issue I am having is that when a new id is selected from the combo box the parameter boxes pop up again asking me for start date and end date again. This happens every time a new combo box id is selected.

I think the way resolve this issue may be to add a start date and end date box to the form but I don't know how to implement this.

Please see the attached files for images of what I currently have. The forum won't let me post images directly here until I have 10 posts so I have had to attach the files instead.:

Query running the form - Attachment 1

The Form itself - Attachment 2

Combo Box - Attachment 3

Bound Column on combo box - Attachment 4

Code in Combo Boxes after update event - Attachment 5

View 3 Replies View Related

Forms :: Adding All Selection To Combo Box That Acts As Filter For SQL Statement

Nov 4, 2014

My form has a combo box which is bound to a query that selects a list of member numbers. The value selected the goes onto filter a list driven by an SQL statement.

Code:
Private Function PopulateADO(qpMemberNo As Long)
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = CurrentProject.Connection
Set rst = New ADODB.Recordset

[Code] .....

This works fine when a single member is selected from the combo. But obviously i want a "select all" or * wildcard option.

Question is 2 parts.
1. How do i add the all or wildcard option to the bound combo?
2. How do i code the all or wildcard option into the SQL statement?
Is it something like is not null ?

View 8 Replies View Related

Forms :: How To Make Subform Filter Its Data From Date Entry Selection

Aug 17, 2014

In my main form, there is this date entry selection and a subform with data on it.

How can I make the subform filter its data from date entry selection?

I have already created a relationships for my tables

I created a query for this subform (should I need to?)

It does not refresh my subform or I do not know what to do?

View 12 Replies View Related

Modules & VBA :: Filter Records - Adding Unbound Date Listbox To Filter String

Feb 10, 2014

I'm trying to hash two scripts I've found into 1 functioning filter, however I'm still relatively new to vba and can't figure out how to get this working.

I'm trying to use Allen Browne's Search Criteria:

with another snippete of code I found here:

Code:
'Purpose: This module illustrates how to create a search form, _
where the user can enter as many or few criteria as they wish, _
and results are shown one per line.

[Code]....

It's the date part I'm having trouble with, the rest of the search criteria work fine without the date, but I can't get it working when I try to modify and merge the date sections of each code.

Also I'm using a listbox for the "Yesterday";"Last 4 days";"Last 9 days" and not a combo box.

View 2 Replies View Related

Confirming Selection From A Listbox

Aug 5, 2005

Hi there

This is what I'm trying to acheive and I'm sure its possible but cant quite get my head around it to do it.

I have a form with a multi select list box from which our customers can select a number of items they would like added to their worklist for the day. They then click on a command button which then sends those items to a table from which our employees then generates a worklist.

However what I would like is that once the customer has entered their selections I would like them to be able to click another command button before submitting the work to the table which would then show them the selections they have made before the info is submitted to the table. They would then review what they've selected and make additions or subtractions as neccessary.

I'm not sure whether or not I have to create two tables the first of which would hold their initial selections and then the first button would then run a query based on that first table and then once they click the submit button it sends that info to another table from which the days worklist can be drawn.

Another question is what if once they've reviewed what they've selected and wish to remove something? If selections go to a temporary table and then they unslected an item will that remove it from the table or would it create a new record which is not what I want.

If you could help that would be most aprreciated. I know very little in the way of coding so any explicit instructions would be most welcomed

regards

Steve

View 4 Replies View Related

ListBox Refreshing After Selection??

Oct 20, 2005

Hi All,

I have a Listbox [ListRandom], that populates a random selection of employees. The listbox is set to "Multiple Select = Simple" What I have now is: I can select several employees and then click a [print] button, this prints an individual form with those employees information, and then adds them to a table [tblselected]. What I am trying to accomplish is After those employees are selected, printed, and added, I then want to go back to the random list to select the other employees, but I would like the first ones that were selected/highlighted to refresh and be gone, so that I dont accidently add the same employee twice.

Is this possible?
And can someone point me in the right direction.
thanks....Enviva

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

ListBox Selection / Disable Fields

Aug 28, 2007

Hi, below is the codes that I use to produce a report based on user entry on a form. On the form is a listbox for the user to select the report they wish to view. On the same form, the user must enter the date. Depending on certain selections, some fields on the form are not required. How can I force the fields that are not required to become disable based on the selection from the listbox. Thanks

Private Sub cmdGetReport_Click()
Dim strRptName As String
strRptName = Me.lstReports.Value

Select Case strRptName

Case "Originations by Branch"

DoCmd.OpenReport "rptOrigByBranch", acViewPreview, , "ClosingDate Between #" & Me.txtStartDate.Value & "# AND #" & Me.txtEndDate.Value & "#"

Case "Loans Sent to Branch"

DoCmd.OpenReport "rptLoanSentBr", acViewPreview, , "Br = '" & Me.txtBranchNo.Value & "' AND ClosingDate Between #" & Me.txtStartDate.Value & "# AND #" & Me.txtEndDate.Value & "#"

End Select



End Sub

View 9 Replies View Related

Listbox Selection And Subforms Problems

Apr 11, 2005

Hello

I'm having trouble with with my form (frmViewCust). What I am attempting to do is create a form which shows a list of customers (from a query) and has a section with the customers details (from tblCustomers). I need it so when a certain customer from the list is selected, their details will be shown in the customer details section.

The best i could do was have the list and details as sub forms (fsubListCust an frmCustDetails). I made frmViewCust to show records from the same query as fsubListCust and create the textbox CustomerID. I successfully made it for when the CustomerID is shown, fsubCustDetails shows correctly corrisponding with the same CustomerID made. How can i make it so when a record is selected from fsubListCust, the subform will change to the same record for frmViewCust.

Alternativly I made it so the list was a list box instead of the sub form, however I still encouter the same problems. I can't make it so the record (shown in the navigational button) is changed to be the same as the record selected in the listbox.

Can anyone tell me what to do?

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

Display Fields After Listbox Selection

Oct 22, 2014

I have been working on this problem for 3 days, and can't figure out what to do. I'm using Access 2010.

I have two tables. Tier1 and Tier2.

Table: Tier1 has Tier1ID (autonumber) and Tier1Desc

Table: Tier2 has
-Tier2id (autonumber)
-Tier1ID (which is the link back to the Tier1 table),
-Tier2Num -- this number shows which tier2 records are associated with each other
- and about 6 fields with descriptive info, 2 of which are memo fields

I have a form that has 2 listboxes:

- Listbox 1 has the row source to Tier1 table, control source Tier1ID
- Listbox 2 is an unbound listbox with the row source to a query.

The query is all the fields from Tier2 with the criteria where Tier1ID in Tier2 table = Tier1ID in Tier1 table

This all works. When I select something from the Tier1 ListBox, it displays the associated tier2 items for the tier1 selection.

What I need : When the selection is made in the 2nd listbox, I need the other 6 fields in tier2 table to be displayed based on the "Tier2Num". The listbox does return Tier2Num correctly.

I just need to display all the rest of the fields.

- I tried a popup form based on a query, but can't seem to pass the tier2Num to a form. (The query works if you enter the Tier2Num, which is the
[listitem] selection)
- I tried dlookup in a textbox
- I tried to add all the fields into the listbox, but could only get 3 to display (then I was going to do textboxes with the control(#) in it.

View 7 Replies View Related

Recall Selected Items From Listbox Selection

Oct 24, 2005

Hi all, greate site and i have been able to solve most problems by using the search box although this problem is doing my head in...!!

I have a db that records project numbers and their details. I am using a listbox to allow a user to multiselect Project Involvements Tasks(ie Documentation, Build etc) against a project number.

I am able to read the selections into a separtate table with two columns which is structured as:

ProjectNo - InvolvementType
123 - Testing
123 - Build
123 - Documentation
456 - Build
789 - Testing
789 - Documentation

as you can see I dont have a problem getting the Itemsselected into a table... the problem that i am having is getting them out again when the record is displayed - ie marking them as itemsselected.

I believe that the event would be onCurrent which would loop through this table pick up the project number and recorded invovements and mark them as selected in the listbox. if there is no invovement then the listbox would show no selections.

I am using this code to read the selections in

===========================
'Records project involvements against project
Public Function AddInvolvements(ctlRef As ListBox) As String
On Error GoTo Err_AddInvolvements_Click

Dim i As Variant
Dim dbs As DAO.Database
Dim rs As DAO.Recordset
Dim qd As DAO.QueryDef
Dim strDelete As String

Set dbs = CurrentDb
Set qd = dbs.QueryDefs!qInvolvement
Set rs = qd.OpenRecordset

'Delete records where project number exists against an invovelment incase of involvement changes
strDelete = "Delete Project_Involvement.ProjectNo " & _
"FROM Project_Involvement " & _
"WHERE (((Project_Involvement.ProjectNo)=[Forms]![Add_Project_Details]![ProjectNo]));"

DoCmd.SetWarnings False
DoCmd.RunSQL strDelete
DoCmd.SetWarnings True

For Each i In ctlRef.ItemsSelected
rs.AddNew
rs!InvolvementType = ctlRef.ItemData(i)
rs!ProjectNo = Me.ProjectNo.Value
rs.Update
Next i
Set rs = Nothing
Set qd = Nothing

Exit_AddInvolvements_Click:
Exit Function

Err_AddInvolvements_Click:
Select Case Err.Number
Case 3022 'ignore duplicate keys
Resume Next
Case Else
MsgBox Err.Number & "-" & Err.Description
Resume Exit_AddInvolvements_Click
End Select

End Function
===================================

Any help would be much appreciated - also thanks to Pat Hartman for his excellent examples esp http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=54924

Regards
Robert

View 3 Replies View Related

Combo Box Selection Displays Results In Listbox

Jun 6, 2005

How do I get my combo box selection to display related results in a list box?
I have a many to many table structure for a contact list that relates many contacts to many costcenters. What I want is when the user selects a costcenter from the combobox the related contacts show in a list box.

Thanks,

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







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