On Mon, 19 Jan 2004 18:09:30 GMT,
dXXXfenton@bway.net.invalid (David W.
Fenton) wrote:
[color=blue]
>nospam@nospam.nospam (Steve Jorgensen) wrote in
><d1fn00tfpe0r4q8cuja6l51rd21rm7tevl@4ax.com>:
>[color=green]
>>Microsoft acknowledges a bug with this, but the bug is worse than
>>they say.
>>
>>It turns out that if you use the Like operator without a wildcard
>>on a snapshot type recordset, all sorts of wierd, undesirable
>>things can happen. This situation can arise when you need
>>something like a list of match conditions, some of which are exact
>>matches.[/color]
>
>I don't quite understand the use of LIKE without an asterisk.
>Wouldn't it be equivalent to "=" ?[/color]
Yes, exactly. In my case, I have a list of rules for how to import from
columns in an import table that can vary from month to month. For some rules,
I know the exact name, and for some rules, I know an invariant part of the
name. I have a table of rules where the match condition is a Like expression,
and if the match is an exact field name, there are no wildcard characters.
This should be a valid thing to want to do, right?
[color=blue]
>I use BuildCriteria for constructing all my WHERE clauses, so I
>never code to cover both exactl and LIKE, which is the only
>scenario I can think of where you'd use LIKE without the asterisk.
>[color=green]
>>According to Microsoft, the bug is that it will treat all
>>expressions without wildcards as if they are followed by *. In
>>fact, I found out that any single character expression such as "B"
>>will match everything! Basically, what this comes down to is that
>>you should never use FindFirst with Like on a Snapshot recordset
>>unless you are certain the expression -will- contain at least one
>>wildcard character.[/color]
>
>Well, D'oh!
>
>Why would anyone make a practice of using LIKE except with a
>wildcard, except coding laziness?[/color]
See above. Like should act like "=" for expressions with no wildcards. Why
should I not expect to take advantage of this fact when I have a list of
criteria, some exact, and some not? As far as I'm concerned, coding laziness
of this sort can be a -good- thing. Use the functionality that -should- be
built in instead of having to write your own code that duplicates that. Now,
I admit, I've recently been advocating doing otherwise when it improves code
clarity and designs out common programmer errors, but this is not one of those
cases.