473,834 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Apply Filter based on Selection of ComboBox

5 New Member
Okay I am using Access 2007 with several tables and several forms.

The main data is saved to table: Load_Records
There is a Form that updates that table named: Add New Loads To Database
There is another Form used for printing custom reports named: Generate Reports

The Generate Reports form automatically creates and populates a recordset by data binding to the Load_Records table. In the footer of this form there are three combo box's named: CompanySelect, DriverSelect and TruckSelect

The values of the combo box's are populated automatically from tables/columns named: Company!Company , Driver!Driver and Truck!Truck

What I want to do is have ALL THE RECORDS of Load_Records filtered automatically OnChange of any or all of these combo box's.

I have played around with DoCmd.ApplyFilt er but have had no success in getting it to work correctly.
Nov 5 '08 #1
10 13489
ADezii
8,834 Recognized Expert Expert
Here is the general idea, assuming all Text Fields:
Expand|Select|Wrap|Line Numbers
  1. Dim strFString As String
  2.  
  3. strFString = "[Company] = '" & Me![cboCompany] & "' And " & _
  4.              "[Driver] = '" & Me![cboDriver] & "' And " & _
  5.              "[Truck] = '" & Me![cboTruck] & "'"
  6. Me.Filter = strFString
  7. Me.FilterOn = True
Nov 5 '08 #2
venuspcs
5 New Member
Okay thanks for the tip but it isn't working for me.....here is a screen shot of the form. The Combobox items are named cboCompany, cboDriver, cboTruck and cboDate.

Here is the code I am using:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub btnFilter_Click()
  3.  
  4.     Dim strFString As String
  5.  
  6.     strFString = "[Company] = '" & Me![cboCompany] & "' And " & _
  7.                  "[Driver] = '" & Me![cboDriver] & "' And " & _
  8.                  "[mmddyy] = '" & Me![cboDate] & "' And " & _
  9.                  "[Truck] = '" & Me![cboTruck] & "'"
  10.     Me.Filter = strFString
  11.     Me.FilterOn = True
  12.  
  13. End Sub
  14.  
  15.  

Nov 5 '08 #3
ADezii
8,834 Recognized Expert Expert
Assuming [mmddyy] is a Date/Time Field (should Rename!):
Expand|Select|Wrap|Line Numbers
  1. Dim strFString As String
  2.  
  3. strFString = "[Company] = '" & Me![cboCompany] & "' And " & _
  4.   "[Driver] = '" & Me![cboDriver] & "' And " & _
  5.   "[mmddyy] = #" & Me![cboDate] & "# And " & _
  6.   "[Truck] = '" & Me![cboTruck] & "'"
  7. Me.Filter = strFString
  8. Me.FilterOn = True
Nov 5 '08 #4
venuspcs
5 New Member
Still doesn't work....every time I click the Apply Filter button I get a single empty row in the recordset.

This is driving me bonkers.....
Nov 5 '08 #5
ADezii
8,834 Recognized Expert Expert
Are there Records that actually meet the criteria making up the Filter?
Nov 6 '08 #6
venuspcs
5 New Member
Yes there are records that meet the criteria of the combo box selections.
Nov 6 '08 #7
ADezii
8,834 Recognized Expert Expert
If I send you my E-Mail Address in a PM (Private Message), would you be willing to send me the Database, so that I could have a first hand look at it?

P.S. _ I only have Access 2007 in work, so I would have to wait until I can get some free time at work in order to diagnose the problem.
Nov 6 '08 #8
venuspcs
5 New Member
If I send you my E-Mail Address in a PM (Private Message), would you be willing to send me the Database, so that I could have a first hand look at it?

P.S. _ I only have Access 2007 in work, so I would have to wait until I can get some free time at work in order to diagnose the problem.
Sure, but I must warn you I am an amateur with Access in every sense of the word....
Nov 7 '08 #9
ADezii
8,834 Recognized Expert Expert
I have the DB and will take a look as soon as I can.
Nov 8 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1709
by: seansan | last post by:
Hi, suppose I have one report that reports some data to me based on a functional area that I define. We have about 20 func_areas and every time the report is the same. Is there some way to have the report ask me (based on a query or something) what func_area I would like the report to be based on? ps. the report is based on a query so ultimately the selection has to be passed to the query.
1
3215
by: Cassie Pennington | last post by:
I have tried to filter one combo box based on a selection in another combo box, by using the following sample code: tblfield=forms!!. However, the combobox only seems to recognise the first record, not the current record in order to limit the list? Any suggestions? Thanks in anticipation
16
18430
by: Nhmiller | last post by:
I already have a report designed under Reports. When I use filtering in Forms or Tables, I see no way to select that filtered list when I am in Reports, and there appears to be no way to do the filtering when I am in Reports. I have received two replies to this message, posted a few days ago within another Subject. One requires making programming type statements. That should not be necessary -- Access must have a quick way to just click...
3
4051
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a table of customers, first column is the key field, which is hidden with a 0" width, and the second column is the customer name. The SQL is a union query that also inserts Null in the first column, and "All" in the second column. That combobox gets...
11
6118
by: Bob | last post by:
I am in the process of upgrading an Access database to SQL Server (and climbing that learning curve!). The wizard happily upgraded all the tables and I can link to them OK using ODBC. The application controls allocation of revisions to aircraft maintenance manuals for an airline type operation. In the application there is a form loaded at start-up allowing the user/s to select the records that they are currently interested in from 4...
2
2130
by: jujubean | last post by:
I have a form with five comboboxes. In the first, the user can select one of four items. The other four comboxes are hidden. Based on the selection made in combobox one, I would like one of the comboxes to be visible, and the other three to remain hidden. Any suggestions? Thanks.
6
6023
by: pouj | last post by:
what i want to do is basically have form where my selection in the combox make the diffrence with what the form reports. this is what the underlying informaion is.... software is access 2007 i got a table where there is name of contacts and with status of away or available then i got form...which has combo box with options AWAY and AVAILABLE and also a command button. then my report has selected colums from the contacts table.
11
20175
by: billa856 | last post by:
Hi, I have project in MS Access.In that I have one form in which there is one combobox .I want to know when I select an item from that combobox and click on submit button then it should open a report which filter data from table.So i only want specific data from table in report based on selection of item from combobox in a form. Can anyone help? Thanks.
1
2783
by: BSTAFFORD | last post by:
I need help. I have a form with a 5 comboboxes. the form also contains a subform query with the saved records from those 5 combobox categories. What I'd like to happen is as a new record is entered and each combobox is updated the subform will automatically filter to the combo box entries. I can get it to filter by one combobox at a time but not all at once. What i'm looking for is like "filter by selection" where the selection is my...
1
2509
by: viranadim | last post by:
I am having problems with attempting to filter a form based on criteria selected in a combo box from another form. I am attempting to filter a form called "Ford CheckList" that is based on a table called "Ford Returned Warranty Parts List". I am using the catagory "Program" that is in a combobox called "Program_Combo" which is located on a form called "Ford Database: Choose an Option". I want the user to open the form "Ford Database: Choose an...
0
9800
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10802
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10516
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10557
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10225
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9340
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7763
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6961
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5802
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.