473,748 Members | 10,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filtering form records using a combo box

3 New Member
This seems like it should be an easy thing, but I think I'm missing something simple here...or I'm just going about it all wrong...

Using Access 2003

I have a form that lists vehicle service dates for different company terminals.
The form loads showing all records.

In the form header I have a combo box named "CSCFilter" that is unbound, and uses the table/query option to list the 16 terminals in our company.

The field I'm trying to filter in the details section is named "CSC"

I'm trying to use the After Update event on the combo box to filter the form based on the selection made on the combo box.
Basically what I have now is 16 identical forms, with each one sorting the CSC manually in the SQL statement...whi ch makes updating the form a pain because I have to make every little change 16x. I want to switch to one form, where I can cycle through the 16 terminals, simply by choosing them on the combo box.

This is what I have in the After Update event:

Expand|Select|Wrap|Line Numbers
  1. Private Sub CSCFilter_AfterUpdate()
  2. Me.Filter = "CSC = " & Me.CSCFilter
  3. Me.FilterOn = True
  4. End Sub
Using this function will get the form to filter correctly, however it's not accepting the value in the combo box as the filter value...it's spitting up a dialog box asking me to enter in the parameter value, but the dialog box is changing it's name to the name selected in the combo box...if that makes any sense.

What am I doing wrong?
Mar 1 '08 #1
4 27801
novoselent
3 New Member
edited initial post...couldn't find the delete option
Mar 1 '08 #2
Stewart Ross
2,545 Recognized Expert Moderator Specialist
This seems like it should be an easy thing, but I think I'm missing something simple here......This is what I have in the After Update event:

Expand|Select|Wrap|Line Numbers
  1. Private Sub CSCFilter_AfterUpdate()
  2. Me.Filter = "CSC = " & Me.CSCFilter
  3. Me.FilterOn = True
  4. End Sub
Hi Novoselent. Your filter is very nearly right - but you are missing some quote marks from your filter string. Without these, you are not passing a string literal to the filter. The value from the combo box is being passed as if it was a field name - and because there is no match for that field it is asking you for the parameter value.

Easy to fix - just change your Me.Filter statement to
Expand|Select|Wrap|Line Numbers
  1. Me.Filter = "CSC = '" & Me.CSCFilter & "'"
-Stewart
Mar 1 '08 #3
novoselent
3 New Member
works like a charm!

I was physically unable to walk away last night until I had it working...so I figured out how to do it, using a macro instead...but I liked my original approach so much better, much cleaner i think. nice to know I was close at least. Those quotes get me all the time...pesky things!

Thanks for helping me get it working!
Mar 1 '08 #4
NeoPa
32,571 Recognized Expert Moderator MVP
Check out Example Filtering on a Form and Quotes (') and Double-Quotes (") - Where and When to use them for assistance with these issues.
Mar 7 '08 #5

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

Similar topics

3
11104
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I have a primary form named TestResults, which is connected to data in a table named TestResults. There are basically two other tables that are related to the TestResults table (and the primary form) named Names-Normalized and SiteAddresses. The...
1
2213
by: Alex | last post by:
Acc97. I have a form which within a subform records machine down time. I have a total of 8 machines. (1-2-3 ect.) What I have been doing is using a combo box linked to the record table to select, the reasons based upon generic terms. The problem is that I have so many records now, that it takes more time looking and picking out the correct fault reason than it does completing the rest of the form!
2
3153
by: Luther | last post by:
I want to create a form that searches a table. The hard part is this, I'd like to have the available records filtered based on combobox selections. For example, if this were a vehicle database, I might want to filter by AutomobileType, Year, Make, Model, Color. In this case it would work like this: First all of the records are available, that is, every kind of auto. So I select from my AutomobileType combobox "2003". Now I only have...
2
5469
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would like to eventually be able to filter down through the tables untill i can reach one unique record. I am creating a datbase to keep track of registered accounts for a stae program. Each account is registered into the program through a two...
0
2018
by: Jason | last post by:
I have a primary form which is used to enter/edit data in a table named Test_Results. On this primary form there is a subform which displays site addresses. This subform is linked to the primary form by field named TestID. The subform is used just for displaying site address data, data which is stored in another table named Total_Site_Address. In the Total_Site_Address table there are numerous fields that form the site addresses...
1
1883
by: MLH | last post by:
I have a form (xxxxxxxxxxxxxx) with a combo-box control (yyyyyyyyyyyyyy). The rowsource property for that combo box is as follows: SELECT DISTINCTROW ., . FROM ; The SQL for qryVehicleList is ... SELECT & " " & & " " & & " & "]" AS Vehicle, tblVehicleJobs.VehicleJobID, tblVehicleJobs.OwnerID, tblVehicleJobs.AuthID, tblVehicleJobs.TowJob,
1
3881
by: hackerslacker | last post by:
I have an ordering form that use two combo boxes to filter down the records of a Products table. This worked fine with the after_Update of the first filtering the records and creating the rowsource of the second combo. The second combo's control source is the Product ID field (foriegn key) on the Orders table. Everything worked well until I decided to enhance the form by changing the second combo to an option group. Now I don't know...
1
2291
by: MLH | last post by:
I have a form with a subform control on it listing records returned by a saved query named UnbilledVehicles. I would like to put command buttons on the main form to apply dynamic filters to the records displayed in the subform control. Say, for instance, to list only 2004 model cars. I'm seeking the simplest approach. The main form is frmCreateInvoice, the subform control is named frmCreateInvoiceSubFormCtl and the actual sub- form is...
3
1811
by: flymo | last post by:
Hello All, I've bee trying out access 2007 and have a weird issue and would like to see if I'm issing something really basic. I have a form based on a query, I create a combo to look for records on my form based on Org_ID. Wgen I create all is fine - I type e, combo goes to e and starts filtering etc just like normal......I save the form, close the database and when I re-open the combo doesn't respond to any input - I can select a...
0
8991
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
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9541
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
9370
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...
0
8242
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
6796
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
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.