Filtering A Form Based Off A List Box?

Mar 24, 2005

how do i filter a form based off what you select in a list box?

thanks
chad

View Replies


ADVERTISEMENT

Filtering A ComboBox List Based On A Table Value?

Nov 12, 2014

My database is centered on a main form where users select pieces of information from ComboBoxes (primarily) and submit.

The first part of the form, they must choose from a list of our clients, which is a table with with roughly 5000 rows.

Later on in the form, they must choose a contact person from that client. While Client's may have several contact names (which need to be stored in a table), only one name is necessary for the form portion.

How can I make this Contact Person ComboBox only load names attached to the specific Client selected above?

As it stands right now, the Client List has its own table (along with additional information), and Contact Name is a separate Table with a look up field of Client List.

View 1 Replies View Related

Forms :: List Filtering Based On Current Record

Dec 2, 2014

I currently have a form that only shows data based on a specific record id. I have placed a list into that form though that has multiple record ID's listed ( It's a log). How do I get a List to Filter to just the Record ID that corresponds to the current form Record.

What I have are as follows:

A form that has client information : Address, phone numbers, Etc.

On that form I have Pages. one of the pages contains a List.

That List however contains information from multiple clients based on Point of Contact ( Call Log)

What I want is a way to narrow the List to only show those that corresponds to the Current Client Record.

Is this possible? If my approach is wrong, which is a better way?

View 1 Replies View Related

Filtering Report Based On Records In A Form

Jul 20, 2006

I am making a Customer Contacts database. The people in this database are organized into 30 groups.

I have one main form, and 30 queries to filter the records displayed on the form

I made buttons on a form representing the different groups of contacts to view, and when you click on one of those buttons, the main form opens with the record source as the query of the group you clicked on.

Here is my coding for one of the buttons

DoCmd.OpenForm "MainForm"
Forms![MainForm]![HomeAddress].Form.RecordSource = "Company Work"


Also on the main form, I have a button to open a report that displays address labels of all the people in the database

How do i code that button, so that the records displayed in that report will be the same as those records displayed on the form? How do i filter the records in the report so they will be the same as in the form?

View 1 Replies View Related

Queries :: Filtering Query Based On Form

Jan 16, 2014

I have a form named form1. In the form I have two unbound text boxes formated as general date; startdate and enddate are the text box names. In my query criteria for the ContactDateTime field I put the following code

Code:
[Forms]![Form1]![StartDate] And [Forms]![Form1]![EndDate]

When I run it I don't get any results. So it runs but no records come up. I have about five queries that run when I click a button and I want to be able to just select start and end dates once on the form and have all the quieries run.

View 3 Replies View Related

Forms :: Filtering A Form Based On ADODB Recordset?

Oct 16, 2013

I have a form that shows records from ADODB recordset.When I try to apply filter to the underlying recordset it works all right but the form doesn't reflect the changes. It shows same rows as before filtering. In debug I can see that the recordset contains only filtered records. Me.Refresh (Recalc, Requery) doesn't work.

Code is as follows:

Dim rs As New ADODB.Recordset
rs.Open sql, conn, adOpenStatic, adLockOptimistic
Set Me.Recordset = rs

Sub combo_AfterUpdate()
Me.Recordset.Filter = "CompanyNo = 123"
End Sub

The form is in Continuous forms mode. I cant use DAO because the data comes from SQL server user-defined function.

View 5 Replies View Related

Reports :: Filtering A Report Based On Chosen Criteria In The Form

Mar 12, 2015

I have a report with a table as the row source. I have command buttons that opens different forms and allows the user to choose criteria, the form then filters the report based on the chosen criteria in the form, but if I use the destination city form to filter the report by destination city, then filter the report using a different form, the destination city filter is lost, is there a way to filter the report with a form by say destination city, then further filter that dataset with another form for say location city.

View 14 Replies View Related

Queries :: Drop Down - Query Not Combining And Filtering Values Based On A Form

Jul 22, 2014

I have a form (DropDown form) that has 3 drop down fields, you select your values from the drop downs and you would push a command button that runs an event procedure which runs a query (DropDown qry test). The user should have the option of picking any combination of fields to filter by. Or no combination, which would return all values in all fields. So I am basically using the form as parameter's for the query.

The problem I'm having is that my query is returning values for one field AND values for another field. Even if the other values selected are not in the same record. It's not combining the fields together to filter. For example: you pick a Project name and Supplier name, the query will return records that have the project name you selected but it will also return records with the supplier name you selected that have a different project name.

I've attached screen shots of the form and the design view of the query (the screen shot cut off the last column name. It is meant to say "Expr3: [Forms]![DropDown form]![Combo7]").

Using Windows 7,
Access 2010

Is there a way to select multiple values from the drop downs?

View 14 Replies View Related

Filtering Combo Box Based On A Value From Another Combo Box (in Multiple Items Form)

Mar 11, 2012

Let's assume we have 3 tables:

Order_Category (Order_Category_ID, Order_Type_Name) with 2 records:
1, Minor
2, Major

Order_Type (Order_Category_ID, Order_Type) with 4 records:
1, Book
1, Pencil
2, Car
2, House

Orders (Order_Category_ID, Order_Type, value) with 2 records:
1, NULL, NULL
1, NULL, NULL
2, NULL, NULL

I want to create a Multiple Items form presenting Orders table with two Combo Boxes:

1. A combo box to select Order_Category_ID.
2. A combo box to select Order_Type. When 1 (Minor) is chosen in the first combo box it should show Book and Pencil, when 2 (Major) is chosen it should show Car and House.

Examples in the Internet show how to do it on a 'single row' forms using the RowSource property. I tried to use a query like:

SELECT Order_Type
FROM Order_Type
INNER JOIN Orders ON Order_Type.Order_Category_ID = Orders.Order_Category_ID
WHERE Order_Category_ID = [comboBoxOrderCategoryID]

But it sets same values for all records in the Multiple Items form and it should return different values in each rows based on value in the first combo box (Order_Category_ID).

View 5 Replies View Related

Filtering A Subform Using A List Box

Jan 8, 2006

I've finally figured out how to populate my list box with radio buttons (3 companys listed on the radio buttons, you click one and employees for that particular company populates the list box). Now I'm trying to figure out how to click on an employee in that box and have their contact information populate the subform that holds that info.

After trying unsuccesfully with VB, I considered using a macro that would open the subform where the Last Name = the Last Name clicked in the list box, but I couldn't figure that out (couldn't figure out what the name would be for the selection in the list box) but I would prefer the subform be there permanantly in "add" mode untill a selection is made in the list box.

I'm code ignorant and rely on google and what books I have for reference / copy-past.....any ideas?

View 3 Replies View Related

Filtering A Subform Using A List Box

Jan 8, 2006

I've finally figured out how to populate my list box with radio buttons (3 companys listed on the radio buttons, you click one and employees for that particular company populates the list box). Now I'm trying to figure out how to click on an employee in that box and have their contact information populate the subform that holds that info.

After trying unsuccesfully with VB, I considered using a macro that would open the subform where the Last Name = the Last Name clicked in the list box, but I couldn't figure that out (couldn't figure out what the name would be for the selection in the list box) but I would prefer the subform be there permanantly in "add" mode untill a selection is made in the list box.

I'm code ignorant and rely on google and what books I have for reference / copy-past.....any ideas?

View 1 Replies View Related

Forms :: Filtering A List Box?

Jun 15, 2013

I have a list box which gets it's data from a query. I would like to filter this query to show only those rows matching a value displayed on the form.

The form displays data from a table and has a text box named PIDLocal.

The query returns a list of PID values and some text SELECT PID, Country, RefCode FROM Query1 The PIDs are integers.

I want the list box to contain only those rows where PID = PIDLocal.

I have tried setting the criteria in the row source query to PID = [Forms]![Show_Details]![PIDLocal], but nothing is returned. If I 'hard-code' a value (eg PID=247) I get the desired result.

View 1 Replies View Related

List Box Of Reports - Filtering Result

Feb 22, 2007

http://allenbrowne.com/ser-19.html

I use the call back function to generate my list of reports in a list box.

I chose to use this method as it seems like an easy way to do what I want, and to a certain extent understand how it works.

What I would really like to be able to do, is have it filter the list of reports.

For example, some reports are for me working behind the scenes, and also so many are subreports that go in to the main report so dont need listing.

I would like to have a report names 'Clients Full Report', 'Clients Medication Report' etc on the list (I dont mind changing report names as I think that will be the key to making it work) So many of my sub reports have client in its name, so if a report could be named '1Clients Main Report' and the code looks for the number 1 and removes the 1 from the list so it displays Clients Main Report on the list.

So its just a way to make the list box only include specific reports based on a number.

Any suggestions?

View 6 Replies View Related

Need Help On Filtering Records Using Combo Or List Box

Feb 18, 2006

Hi, I need help on my search command. I am hoping to be able to use a combo box or a list box coming from a table as my criteria to use to filter records from a form and present it a subform/subreport upon clicking the command button. Ideally I should have a form wherein I will have a either a combo box or list box for my criteria, a subform/subreport, and a command button. When I select a particular item on the combo box or list box and I click the command button, the subform/subreport would show me records matching only the particular criteria I selected.

I tried using several approach but it's not working, I don't know what I'm doing wrong. Please help me, I am just learning how to do this all by myself.

First Approach:
I tried using a list box to list all the countries I have available from the country table and a command button so when I select a country from the list box and click on the command button I will be able to show on a datasheet view only records matching the country criteria.
This is the code I used:
__________________________________________________ _______________
Private Sub Preview_Click()

DoCmd.OpenForm "qrysumcountry subform", , "Country", "Country = [List4]"

End Sub
__________________________________________________ _______________
But everytime I click on the command button Preview, I am always asked to enter parmeter value then when I type the country that's when it shows the record in forms format matching the criteria country but when I dont type anything and click ok, it just shows a blank form and indicates it's filtered but no record is showing. But I click cancel, it shows a Run-time error '2501'. why does it still have to make me type the parameter if I have selected it on the list box already?

Second Approach:
On the form: I used a combo box, a subform/subreport and a command button. On the combo box I have to show different countries available on my country table. on the subform/subreport I have used my a form created from a query. I want to select from the combo box a particular country and used it as my criteria to filter the records I have on my subform when I click on the search command button. I tried following the sample given by gromit but it doesn't want to work on my database.

This is the code I followed:
__________________________________________________ _______________
Private Sub btnClear_Click()
Dim intIndex As Integer
Me.cmbCountry = 0

End Sub

Private Sub btnsearch_Click()
Me.frmqrybyCountry1.Form.RecordSource = "SELECT * FROM qrybycountry" & BuildFilter

Me.frmqrybyCountry1.Requery

End Sub

Private Function BuildFilter() As Variant
Dim varWhere As Variant

varWhere = Null ' Main filter


'Check if there is a filter to return...
If IsNull(varWhere) Then
varWhere = ""
Else
varWhere = "WHERE " & varWhere

' strip off last "AND" in the filter
If Right(varWhere, 5) = " AND " Then
varWhere = Left(varWhere, Len(varWhere) - 5)
End If
End If

BuildFilter = varWhere

End Function
__________________________________________________ _______________
After selecting on the combo box and click on the command button it just shows all record. It doesn't seem like it is reading what I selected from the combo box as my criteria to filter the records. What could be I be doing wrong? Honestly, I dont understand what is happening to the code here especially the BuildFilter function.

Please help me, I would really want to figure this problem out. Thank you so much.

View 2 Replies View Related

Forms :: Filtering (All) From Combo Box Value List?

Jul 19, 2013

I have a combo box on a form which has a row source type of Value List in which I've manually typed in 2 entries: Owned, Leased.

I have a query which filters on the results of the combobox, and works fine for when I select either option Owned or Leased.

Is there an easy way to filter all (both Owned & Leased)? I've tried leaving the combobox blank, and tried entering a * in the value list, but they both return no results.

Code:

SELECT Assets.*
FROM Assets
WHERE (((Assets.Possession)=[Forms]![Home]![Combo56]));

View 4 Replies View Related

Modules & VBA :: Filtering Results In List Box

Apr 21, 2014

I am using a form in which i am filtering the results in the list box based on the textbox value. I am dynamically switching 3 row sources for the list box.

My Need is that the results produced in the listbox should get filtered again when typing in the second text box i.e based o the country name.

View 1 Replies View Related

Forms :: Three Linked Tables - Filtering A Filtered List

Mar 21, 2013

I have three linked tables [Regulator], [RuleBook] and [Rules] (each has a corresponding form for data entry).

In the "Rules" form, when you select name of the regulator, the rule books dropdown down is filtered to show only the rulebooks for that regulator. the code I use is:

Private Sub Regulator_Change()
Me.[Rule Book].RowSource = "SELECT [ID],[Rule Book],[Short Code],[Regulator],[RegName],[Short Form],[Active] FROM" & _
" [RuleBook] WHERE Regulator = " & _
Me.Regulator
Me.[ShortReg] = Me.Regulator.Column(3)
End Sub

Basically, if I select the FSA as the regulator, The Rule Books drop down is filtered to only show the FSA Rule Books. If I pick OFT, I get the OFT list etc. This all works fine.

In the [RuleBook] table, each entry has a yes/no tick box called "Active".

The reason for this being that the regulators change their rule books quite regularly, but from an audit perspective, I can't delete or overwrite the old ones once they are no longer valid.

What I want to do, is further filter the rule book list to those where Active=True so that when I select FSA, I can only choose from their current rule books and not the ones that are no longer relevant.

View 7 Replies View Related

Queries :: Form List Based On A Query Returns Original ID Value Not Field Text

Aug 14, 2014

I have a table x where the field value is selected via a combo box in a form that is populated from another table z.

When I look in x, it appears to have correctly stored the text from z, not the ID number.

I then built a Query, qX, which looks in x and grabs the fields I want. That query shows the text correctly in each selected field.

Now when I build a form, frmQx and use a List control, it displays some of the fields as ID values from the original table z, not the text values.

How can I get round this? I've searched and searched for an answer, sigh. Maybe I'm just not quite certain how to phrase the search.

View 5 Replies View Related

Forms :: Filtering List Box Using A Date Rage And Combo Selection

Jan 5, 2014

I am using this code to filter a List Box based on a Date range and a Combo Box selection:

Code:
Private Sub Combo139_AfterUpdate()
Dim StrgSQL As String
StrgSQL = "SELECT [User Name], [Date Of Request], [Description of Problem], Status, Sub_Job FROM QRY_SearchAll " & _
"WHERE [Date of request] BETWEEN #" & CDate(Me.txtStartDate) & _
"# AND #" & CDate(Me.txtEndDate) & "#;"
StrgSQL = StrgSQL & " WHERE Sub_Job = Combo139"
Me.SearchResults.RowSource = StrgSQL
Me.SearchResults.Requery
End Sub

However, It is not working. when I click the Combo box the List Box comes up blank.

View 13 Replies View Related

Reports :: Filtering Based On Two Criteria

Aug 5, 2015

I am having trouble filtering my report. My goal is to filter the report by:

1) [DateChanged] by user entry on a form (txtFrom and txtTo)
2)[Deliverable] by selection of a list box on form

My error is in the last line when i open the report. It only lets me filter using either option 1 or 2. When I include the "And", it gives me the error "Type Mismatch". I know its a syntax error.

My code is below

'''''''''''''''''''''''''''''''''''''''''''''''''' '''
Dim Deliverable As String
Dim DateChanged As String
Dim VarItm As Variant
For Each VarItm In List2.ItemsSelected
Deliverable = Deliverable & "[ID] = " & List2.Column(0, VarItm) & " OR "

[Code] .....

View 3 Replies View Related

Forms :: Filtering Out Based On A Filled Field?

Jul 7, 2015

I have a form that I want to filter out certain records based on if a field has data in it or not. I tried using a macro and putting the field equals "IsNotNull", but that didn't work. I just asked me what "IsNotNull" is suppose to be. correct way to do this via macro?

I tried searching but was finding VBA with other filters being applied (which is not the case).

View 3 Replies View Related

General :: Filtering Listbox Based On Tab Control

Jul 24, 2014

So I have a Tab control. Each tab is assigned to a specific user (which is controlled through another form). So If I assigned Page1 to Smith then Page1 caption reads Smith. Within each page is a list box that is filtered based on what name is in the caption. This works perfectly. My problem is I have another list box that is not within the tab control. I wan this to be filtered based on what tab is active. Both list boxes are bound to a query.

View 4 Replies View Related

Filtering Records Based On Multiple Checkboxes

Apr 25, 2014

I am using Access 2013, I have a recipe project with multiple one-to-many relationships. The main table in all of them is RECIPE. Child tables are HOLIDAY, SPEC_NEED, COURSE... each one of these child tables are comprised of multiple checkbox columns (yes or no)...

I need to filter the RECIPE records based on the selected checkboxes in these child tables..so for example if COURSE.Appetizer is checked and HOLIDAY.Christmas is checked RECIPE will produce the appropriate records. How to pull this one off...I am currently using the Options Group design tool and have used a separate Options Group design for each of the child tables...

View 9 Replies View Related

Design Problem - Filtering Combo Box Items Based On Related Table Field

Apr 19, 2007

Hi im stuck on filtering a combo box (i am using an sql query to populate a combo box with a filtered selection, this is in Access but im after some design sanity checking). I have users who can be assigned a category. Jobs can be assigned a category and also have a list of people working on that job (in the JobDetails table). I have the following tables:

Categories Table:
CategoryID (PK)
Description


Users Table:
UserID (PK)
Username
CategoryID (FK on Categories.CategoryID)


Jobs Table:
JobID (PK)
CategoryID (FK on Categories.CategoryID)


JobDetails Table:
JobID (FK on Jobs.JobID)
UserID (FK on Users.UserID)

Then in the job details when listing users for a job (many users can be for one job) i would like to only show the users which have the same category as the jobs category. Is this possible? i tried the SQL below for the lookup column field JobDetails.UserID but it doesnt work:

SELECT Users.ID, Users.Username, Users.CategoryID
FROM Users, Jobs
WHERE (((Users.CategoryID)=[Jobs].[CategoryID]));

All the tables are linked with relationships but my SQL isnt so hot!
Any ideas as to how i would do this and get it working?

Even if it can be done, is this even recommended? I can see funny conditions happening if the job details category changes or the users category changes then even if they are existing in the job details list they will not be shown? Even so, i would be interested in the above to know how it is done (if possible).

Thanks in advance,

Chris

View 2 Replies View Related

Filtering Field In 2nd Subform Based On Selection In 1st Subform

Sep 1, 2006

I almost have this form done.

I have a form with a combo box, and 2 subforms from it. When you select in the combo box (Group), it brings up the choices (Sections) for that group in a subform. Then there is another subform, that is supposed to bring up a series of questions that are related to the section that has been selected. The question field has a drop down to a list table, that has all the questions. Once the question has been selected, it stores in a Master table. The relationship is there. If you try to select any questions that do not pertain to the section, it gives you an error message.

What I need it to do, is when the section is selected, filter out the questions that pertain to that section, and have those questions be the only ones available in the drop-down list to choose.

I know that I need to have an After Update code once the section has been selected, but not sure how the coding should be.

I hope that someone can help with this!

:confused:

View 1 Replies View Related

Filtering Field In 2nd Subform Based On Selection In 1st Subform

Sep 1, 2006

I have a form that is almost complete

I have a form with a combo box, and 2 subforms from it. When you select in the combo box (Group), it brings up the choices (Sections) for that group in a subform. Then there is another subform, that is supposed to bring up a series of questions that are related to the section that has been selected. The question field has a drop down to a list table, that has all the questions. Once the question has been selected, it stores in a Master table. The relationship is there. If you try to select any questions that do not pertain to the section, it gives you an error message.

What I need it to do, is when the section is selected, filter out the questions that pertain to that section, and have those questions be the only ones available in the drop-down list to choose.

I know that I need to have an After Update code once the section has been selected, but not sure how the coding should be.

I hope that someone can help with this!

View 1 Replies View Related







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