Filter button / Select statement / String part

  • Thread starter Thread starter Kevin Bruce
  • Start date Start date
K

Kevin Bruce

On a form with 20 filter buttons, I have one that is designated to pull any
record where the so-called "DistrictAndAffiliationID" begins with the
letters "SD".

Case Is = 17
Me.Filter = "Left$(DistrictAndAffiliationID, 2) = 'SD'"
Me.FilterOn = True

This doesn't run, however. Am I doing something wrong?


================================
Kevin Bruce
Program Coordinator
ArtStarts in Schools
301 - 873 Beatty Street
Vancouver, BC V6B 2M6

ph:604-878-7144 ext.3
fx: 604-683-0501

web: www.artstarts.com
 
-----Original Message-----
On a form with 20 filter buttons, I have one that is designated to pull any
record where the so-called "DistrictAndAffiliationID" begins with the
letters "SD".

Case Is = 17
Me.Filter = "Left$(DistrictAndAffiliationID, 2) = 'SD'"
Me.FilterOn = True

This doesn't run, however. Am I doing something wrong?


================================
Kevin Bruce

Hi Kevin,
try setting a breakpoint in the procedure and then
stepping through it as it runs. When you do this check the
value in this field - does it actually begin with 'SD' ?

Maybe there is something else that is causing the
problem...

Luck
Jonathan
 
Thanks for your assistance, Jonathon.

There is more to my problem than meets the eye...

The same code in a copy of the database from a month ago runs just fine. I
have imported that form and code into the current database but I get the
same errors. I have imported the current form and code into the copy and it
runs okay. So, something has happened to my data in the past month.

If, in the current database, I replace the line:

Me.Filter = "Left$(DistrictAndAffiliationID, 2) = 'SD'"

with something like:

Me.Filter = "DistrictAndAffiliationID, = 'SD36'"

that runs fine as well, pulling out all those records associated with SD36.
So, that means that these records do indeed start with "SD" as you suggested
I check.

I am completely mystified as to what to try next. Any suggestions?

_Kevin
 
-----Original Message-----
Thanks for your assistance, Jonathon.

There is more to my problem than meets the eye...

The same code in a copy of the database from a month ago runs just fine. I
have imported that form and code into the current database but I get the
same errors. I have imported the current form and code into the copy and it
runs okay. So, something has happened to my data in the past month.

If, in the current database, I replace the line:

Me.Filter = "Left$(DistrictAndAffiliationID, 2) = 'SD'"

with something like:

Me.Filter = "DistrictAndAffiliationID, = 'SD36'"

that runs fine as well, pulling out all those records associated with SD36.
So, that means that these records do indeed start with "SD" as you suggested
I check.

I am completely mystified as to what to try next. Any suggestions?

_Kevin


Kevin
these 2 are different in what they are acheiving
Me.Filter = "Left$(DistrictAndAffiliationID, 2) = 'SD'"
Me.Filter = "DistrictAndAffiliationID = 'SD36'"

the first is looking for values that match 'SD'
the second is looking for exact match with 'SD36'

try
Me.Filter = "DistrictAndAffiliationID like 'SD*'"

Luck
Jonathan
 
Thanks, Jonathon. That's licked the problem.

Now all I have to do is figure out who went into the code window and deleted
the ' * ' from my original code!

_Kevin
 
Back
Top