You can use instr unless you open a mdb file. This has NOTHING to do with
So, would you appreciate a new thread?
No, not at all. The wording of your subject suggested that the problem was
you can't search for a * in a string.
In fact, the problem is you can't search ANY character in a string without
first loading a mdb file. Not really a big deal, but it would have been MUCH
more useful to point that you can't search for any character (else, one
would have to conclude this is some type of delimiter problem...which it is
not).
Not a big deal here..but the problem was not clear until discovered that
instr() for ANY character did not work...
But i can use
? instr(1, "abc", "b", vbCompareText)
InStr seems to be an overloaded function. These functions can be called at
the same time, but they have different boundary conditions, which are
_not_ documented.
I have absolute no idea as to why the fact of InStr being a overloaded
function is relevant here? I don't think the failue is due to any boundary
issue
at all...
Hum, it might overloaded function, but that would not explain in ANY way as
to why the 2nd
use of the function works without the extra parameters....
On the other hand, since you supply a vbTextCompare, perhaps the method
simply sets some type of code page for the language used, and thus sets up
the type of string compare to use.
Remember, most code modules for their first line have
Option Compare Database
So, the fact of a overloaded function really don't matter here much ....
It very simply might be a matter of setting the code page, or the type of
string comparison to use. Once set..then the function can operate. This
seems like a far more likely reason as to why it works the 2nd time....
What this means is that this might not be a issue of libraries not being
loaded, but in fact that the code page, or string comparison method is NOT
set unless you have a mdb loaded. From the a2003 help on instr you get for
the text compare option the following
<quote>
compare : Optional.
Specifies the type of string comparison. If compare
is Null, an error occurs. If compare is omitted, the Option Compare setting
determines the type of comparison. Specify a valid LCID (LocaleID) to use
locale-specific rules in the comparison.
</quote>
So, it seems it is documented that if you omit the compare setting, then the
one you set in the module is used....but, how can that occur, since you have
no code modules loaded?
At the end of the day, it simply means that some functions and methods will
operate differently in ms-access depending on the MANY MANY settings that
ms-access has. I don't think it goes without saying that these settings need
to be set correctly before some functions can be used. How strings compare,
or even things like how sql will be processed is a option in the
tools->options.
So, trying to use ms-access as a automation (com) object sounds like a risky
idea unless you open up a mdb.....