473,320 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Microsoft Access - Filters Controlled via a combo box

Hello,
I am currently working on a Stock Control database and I am trying to set a filter on the form using a combo box.

At present I am using a continuous form with the combo box being placed in the header so that it is always viewable.

I have put the code in to the form however every time i select anything in the combo box I get an error message saying:
run-time error '2501':
The ApplYFilter action was canceled
The combo box name is: cmbProductSearch

The code that I have in place is:
Expand|Select|Wrap|Line Numbers
  1. 'filter that is used to filter the records based on product name
  2. Private Sub cmbProductSearch_Change()
  3.  
  4. currentFilter = "((((tblProducts.ProductDescription) = " + "'" + cmbProductSearch + "')))"
  5.  
  6. Filter = currentFilter
  7.  
  8. DoCmd.ApplyFilter , Filter
  9.  
  10. End Sub
  11.  
I have tried using both Access 2003 and Access XP
I have used Windows XP Home and Windows XP Professional

I would really appreciate any help on this as I seem to have hit a very large brick wall as I have now tried many different things that I have found on the web.

Best Regards,
Ben
Mar 26 '07 #1
1 1955
MMcCarthy
14,534 Expert Mod 8TB
Hi Ben,

Q. where is currentFilter defined?

Also you have to use '&' not '+' as follows:

Expand|Select|Wrap|Line Numbers
  1. 'filter that is used to filter the records based on product name
  2. Private Sub cmbProductSearch_Change()
  3.  
  4. currentFilter = "[ProductDescription] = '" & Me!cmbProductSearch & "'"
  5.  
  6. Filter = currentFilter
  7.  
  8. DoCmd.ApplyFilter , Filter
  9.  
  10. End Sub
  11.  

Mary
Mar 26 '07 #2

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

Similar topics

3
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or...
4
by: Robert | last post by:
Greetings I am assisting a developer with an Access application performance problem and an ODBC timeout. In a nutshell they have a combo box with a drop down that queries a lookup table on a SQL...
3
by: pechoi | last post by:
Hi, I am kind of new at Access (pretty good with VBA I think :). I am trying to retrieve data using SQL statement. I have a table with 5 field: ID (Access given), Card1, Card2, Group, Point. I...
3
by: Brian Graham | last post by:
I have a combo box with a query for a list of names etc. The table has 250,000 rows. The query returns 250,000 rows. But the list returns only 97,000 rows and then shows blank columns after that, so...
6
by: smcdonald | last post by:
I have a report that opens up using a pretty complex query. I then pop up a form with combo boxes so the user can apply a filter to the existing report and then refresh the report. I need to export...
2
by: brino | last post by:
hi all ! my client wants to bring out data into a report with a number of filters that are chosen by the user . eg. -Section -Days to search -Type of care ive never tried this before...
1
by: favor08 | last post by:
I need help with a big project. I am struggle getting multiple option buttons and filters to work together. They need to be able to filter a subform. My first set of option buttons work fine all...
2
by: MarcoEffe | last post by:
Hi all, I'm a newbie on db issues. I'm using an Access2000 .mdb file on a VB6 user application. I need to modify, at run-time, the ordering filters of the columns, using a SQL query or DAO...
8
by: stuart wieder | last post by:
i have an application containing a header with 5 filters (combo boxes) and 2 search boxes (text boxes). When the search boxes are used and return no records in the detail of the form, the actual...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.