473,952 Members | 12,252 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access 2003 - Me.Filter - not working?

8 New Member
I have some Access 2003 VBA code that looks like this:

Private Sub SubName()
Me.FilterOn = True

Me.Filter = ""

' Me.FilterOn = False
' Me.Requery
x = msgbox("Filter Cleared. Number of Records: " & Me.Recordset.Re cordCount)

Me.Filter = "Mother LIKE '%" & PT_Mother.Text & "%' OR Mother_AKA LIKE '%" & PT_Mother.Text & "%'"

' Me.FilterOn = True
' Me.Requery
x = msgbox("Filter Applied. Number of Records: " & Me.Recordset.Re cordCount)
End Sub


What happens the FIRST time this sub is run is that the first msgbox shows an unfiltered total like it's supposed to. The second msgbox shows 0 records.
All subsequent runs yield what looks like random quantities of records, that don't have anything to do with the filter.

Attempting to toggle .FilterOn or .Requery doesn't seem to help.

I'm new to Access VBA, and there's probably something I'm missing, but what?
Dec 6 '07 #1
4 5457
puppydogbuddy
1,923 Recognized Expert Top Contributor
This question duplicates your other post
http://www.thescripts.com/forum/thread745378.html
This causes confusion and is against site rules.
Dec 6 '07 #2
Sheree
8 New Member
This question duplicates your other post
http://www.thescripts.com/forum/thread745378.html
This causes confusion and is against site rules.
This code is different than the other code. This code uses the form's Me.Recordset property, and the other code uses an ADO recordset. Whichever works, but they do not use exactly the same properties and methods!
Dec 6 '07 #3
MikeTheBike
639 Recognized Expert Contributor
This code is different than the other code. This code uses the form's Me.Recordset property, and the other code uses an ADO recordset. Whichever works, but they do not use exactly the same properties and methods!
Hi

I could be wrong (what again!), but I believe that the form recordset is DAO, which uses * as the wild card characture, but ADO (and SQL ?) uses %.

Could that be the problem?

MTB
Dec 6 '07 #4
Sheree
8 New Member
Hi

I could be wrong (what again!), but I believe that the form recordset is DAO, which uses * as the wild card characture, but ADO (and SQL ?) uses %.

Could that be the problem?

MTB
I guess it could -- I've never used DAO before... just ADO scripting with vbscript, javascript, and now (grumble grumble *RABBLE RABBLE*) VBA. I've switched it back to ADO though, as I'm having better luck with it in general. (That would be that other thread referenced above.)
Dec 6 '07 #5

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

Similar topics

14
5440
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB 7.2 environment, the choices the optimizer makes often seem flaky. But this last example really floored me. I was hoping someone could explain why I get worse response time when the optimizer uses two indexes, than when it uses one. Some context:
1
1969
by: Emilio | last post by:
(MS Access 2002) Hello, I'm working with some big Census (PUMS) files, and I run into a peculiar problem once the data field exceeds five integers. I'll explain every step, since I am doing it in a somewhat complicated manner. 1. I filter the data to include only those serial numbers (field name) that include a specific value in another field. 2. Those serial numbers are exported into Excel, where it's easier for me to work the...
3
24049
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked tables in the database where the code resides. If we move the database with the data tables to a new directory, the links are no longer valid. I tried to update the links by changing the Connect property and refreshing: Set td = db.TableDefs(0)...
0
2084
by: Mike O. | last post by:
MS Access 2003 "filter by form" has drop down lists that allow the user to select values for each field to filter by. However, once some values are selected,the remaining dropdown lists remain the same and aren't progressively filtered to reflect the selections already made in other fields. This can be very tedious when filtering a large datasheet. Unlike Access, the MS Excel autofilter has automatic progressive filtering of value...
9
3221
by: Alan Lane | last post by:
Hello world: Background: Yesterday, January 21, Doug Steele was kind enough to help me out on a Left Join problem. I was trying to return all stores and their Gross Adds for December, 2004 (even though some of them had no Gross Adds for that month). My query would only show the non-zero GA stores. Doug stated "It's because of the Where clause. The stores which don't have any records for the period in question are being eliminated...
1
3866
by: David1129 | last post by:
I'm working on testing a large application with Access 2007. It has been running under 2003 and XP with no obvious errors. However with 2007 many forms seem to have lost the ability to filter. When the form is loaded, the record source specifed, a filter applied, and filtering set to on, either no records are displayed, or ALL of the records displayed. Click on the "Toggle Filter" on the ribbon and voila, the resordset is displayed. ...
1
1997
by: bwakefield | last post by:
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: The combo box name is: cmbProductSearch The code that I have in place is:
2
6090
by: Andy | last post by:
Hi guys I having a problem creating a report in Access 2003 project talking to a SQL database through and ODBC connect. After hours of trying things from Access Help, MSDN and Google I still can't get it working. I have a query defined (view) and want the end user to put in a start date and end date to filter a report.
4
2672
by: daved | last post by:
SOLUTION NEEDED FOR ACCESS 2003 / VBA, NOT FOR ANY VERSION OF VB. I need to differentiate between the Enter key on the main keyboard and the numeric keypad and obviously tried using vbkeySeparator in the form’s Keypress event. However, both Enter keys return KeyCode 13. MS Q188550 (below) offers a workaround for VB only – it does not claim to fix VBA. On this basis you might expect that the bug is fixed in Access/VBA but it isn’t. I...
0
10183
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
10000
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
11210
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
11383
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
9919
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...
0
7453
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
6241
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...
1
4971
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.