473,410 Members | 1,852 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,410 software developers and data experts.

Access 2003 - Me.Filter - not working?

8
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.RecordCount)

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.RecordCount)
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 5427
puppydogbuddy
1,923 Expert 1GB
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
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 Expert 512MB
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
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
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...
1
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...
3
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...
0
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...
9
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...
1
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....
1
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...
2
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...
4
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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,...

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.