PC Review


Reply
Thread Tools Rate Thread

Access INSTR function fails in SQL for some Japanese characters

 
 
.
Guest
Posts: n/a
 
      6th Dec 2006
The Instr function will return an incorrect substring position for
values containing some Japanese characters. While most Japanese
characters are fine, some characters such as グ(GU - \u30b0) and
プ(PU \u30D7) will be counted as two characters by the Instr function
offsetting the returned position incorrectly. Most importantly, the
returned position is incorrect even when passed as an argument to the
Mid function. Most other Japanese characters function correctly when
passed to the Instr function.

For example,
Mid( ‘グab’, Instr(‘グab’, ‘a’), 1)
will incorrectly return ‘b’. With most other Japanese characters,
‘a’ would be correctly returned.

Is this a known problem? Is there some way to work around this?

thanks

mike

 
Reply With Quote
 
 
 
 
Brendan Reynolds
Guest
Posts: n/a
 
      6th Dec 2006
Does it make any difference if you specify the optional arguments? For
example ...

Mid( '?ab', Instr(1, '?ab', 'a', vbTextCompare), 1)

.... or ...

Mid( '?ab', Instr(1, '?ab', 'a', vbBinaryCompare), 1)

.... or ...

Mid( '?ab', Instr(1, '?ab', 'a', vbDatabaseCompare), 1)

--
Brendan Reynolds
Access MVP

"." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
The Instr function will return an incorrect substring position for
values containing some Japanese characters. While most Japanese
characters are fine, some characters such as ?(GU - \u30b0) and
?(PU \u30D7) will be counted as two characters by the Instr function
offsetting the returned position incorrectly. Most importantly, the
returned position is incorrect even when passed as an argument to the
Mid function. Most other Japanese characters function correctly when
passed to the Instr function.

For example,
Mid( '?ab', Instr('?ab', 'a'), 1)
will incorrectly return 'b'. With most other Japanese characters,
'a' would be correctly returned.

Is this a known problem? Is there some way to work around this?

thanks

mike


 
Reply With Quote
 
.
Guest
Posts: n/a
 
      6th Dec 2006
Since it's embedded in SQL access doesn't support the
vbTextCompare/vbBinaryCompare option.

On Dec 6, 5:07 pm, "Brendan Reynolds"
<brenr...@discussions.microsoft.com> wrote:
> Does it make any difference if you specify the optional arguments? For
> example ...
>
> Mid( '?ab', Instr(1, '?ab', 'a', vbTextCompare), 1)
>
> ... or ...
>
> Mid( '?ab', Instr(1, '?ab', 'a', vbBinaryCompare), 1)
>
> ... or ...
>
> Mid( '?ab', Instr(1, '?ab', 'a', vbDatabaseCompare), 1)
>
> --
> Brendan Reynolds
> Access MVP
>
> "." <mr.humph...@gmail.com> wrote in messagenews:(E-Mail Removed)...
> The Instr function will return an incorrect substring position for
> values containing some Japanese characters. While most Japanese
> characters are fine, some characters such as ?(GU - \u30b0) and
> ?(PU \u30D7) will be counted as two characters by the Instr function
> offsetting the returned position incorrectly. Most importantly, the
> returned position is incorrect even when passed as an argument to the
> Mid function. Most other Japanese characters function correctly when
> passed to the Instr function.
>
> For example,
> Mid( '?ab', Instr('?ab', 'a'), 1)
> will incorrectly return 'b'. With most other Japanese characters,
> 'a' would be correctly returned.
>
> Is this a known problem? Is there some way to work around this?
>
> thanks
>
> mike


 
Reply With Quote
 
Brendan Reynolds
Guest
Posts: n/a
 
      7th Dec 2006

They're just constants, in SQL use the literal values. 0 = vbBinaryCompare,
1 = vbTextCompare, 2 = vbDatabaseCompare. You can find these values in the
Object Browser or just print them in the Immediate Window ...

? vbBinaryCompare
0
? vbTextCompare
1
? vbDatabaseCompare
2

I can't promise that this will work, as I wouldn't know how to go about
entering Japanese characters in order to test it. But it may be worth a try.

--
Brendan Reynolds
Access MVP

"." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Since it's embedded in SQL access doesn't support the
> vbTextCompare/vbBinaryCompare option.
>
> On Dec 6, 5:07 pm, "Brendan Reynolds"
> <brenr...@discussions.microsoft.com> wrote:
>> Does it make any difference if you specify the optional arguments? For
>> example ...
>>
>> Mid( '?ab', Instr(1, '?ab', 'a', vbTextCompare), 1)
>>
>> ... or ...
>>
>> Mid( '?ab', Instr(1, '?ab', 'a', vbBinaryCompare), 1)
>>
>> ... or ...
>>
>> Mid( '?ab', Instr(1, '?ab', 'a', vbDatabaseCompare), 1)
>>
>> --
>> Brendan Reynolds
>> Access MVP
>>
>> "." <mr.humph...@gmail.com> wrote in
>> messagenews:(E-Mail Removed)...
>> The Instr function will return an incorrect substring position for
>> values containing some Japanese characters. While most Japanese
>> characters are fine, some characters such as ?(GU - \u30b0) and
>> ?(PU \u30D7) will be counted as two characters by the Instr function
>> offsetting the returned position incorrectly. Most importantly, the
>> returned position is incorrect even when passed as an argument to the
>> Mid function. Most other Japanese characters function correctly when
>> passed to the Instr function.
>>
>> For example,
>> Mid( '?ab', Instr('?ab', 'a'), 1)
>> will incorrectly return 'b'. With most other Japanese characters,
>> 'a' would be correctly returned.
>>
>> Is this a known problem? Is there some way to work around this?
>>
>> thanks
>>
>> mike

>



 
Reply With Quote
 
.
Guest
Posts: n/a
 
      7th Dec 2006
Yes, but the constants are not accepted inside a sql clause either.

thanks,

mike

On Dec 7, 5:03 am, "Brendan Reynolds"
<brenr...@discussions.microsoft.com> wrote:
> They're just constants, in SQL use the literal values. 0 = vbBinaryCompare,
> 1 = vbTextCompare, 2 = vbDatabaseCompare. You can find these values in the
> Object Browser or just print them in the Immediate Window ...
>
> ? vbBinaryCompare
> 0
> ? vbTextCompare
> 1
> ? vbDatabaseCompare
> 2
>
> I can't promise that this will work, as I wouldn't know how to go about
> entering Japanese characters in order to test it. But it may be worth a try.
>
> --
> Brendan Reynolds
> Access MVP
>
> "." <mr.humph...@gmail.com> wrote in messagenews:(E-Mail Removed)...
>
>
>
> > Since it's embedded in SQL access doesn't support the
> > vbTextCompare/vbBinaryCompare option.

>
> > On Dec 6, 5:07 pm, "Brendan Reynolds"
> > <brenr...@discussions.microsoft.com> wrote:
> >> Does it make any difference if you specify the optional arguments? For
> >> example ...

>
> >> Mid( '?ab', Instr(1, '?ab', 'a', vbTextCompare), 1)

>
> >> ... or ...

>
> >> Mid( '?ab', Instr(1, '?ab', 'a', vbBinaryCompare), 1)

>
> >> ... or ...

>
> >> Mid( '?ab', Instr(1, '?ab', 'a', vbDatabaseCompare), 1)

>
> >> --
> >> Brendan Reynolds
> >> Access MVP

>
> >> "." <mr.humph...@gmail.com> wrote in
> >> messagenews:(E-Mail Removed)...
> >> The Instr function will return an incorrect substring position for
> >> values containing some Japanese characters. While most Japanese
> >> characters are fine, some characters such as ?(GU - \u30b0) and
> >> ?(PU \u30D7) will be counted as two characters by the Instr function
> >> offsetting the returned position incorrectly. Most importantly, the
> >> returned position is incorrect even when passed as an argument to the
> >> Mid function. Most other Japanese characters function correctly when
> >> passed to the Instr function.

>
> >> For example,
> >> Mid( '?ab', Instr('?ab', 'a'), 1)
> >> will incorrectly return 'b'. With most other Japanese characters,
> >> 'a' would be correctly returned.

>
> >> Is this a known problem? Is there some way to work around this?

>
> >> thanks

>
> >> mike- Hide quoted text -- Show quoted text -


 
Reply With Quote
 
Brendan Reynolds
Guest
Posts: n/a
 
      7th Dec 2006

Works for me ...

SELECT Customers.CompanyName, InStr(1,[CompanyName],"e",1) AS Expr1
FROM Customers;

--
Brendan Reynolds
Access MVP

"." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Yes, but the constants are not accepted inside a sql clause either.
>
> thanks,
>
> mike
>
> On Dec 7, 5:03 am, "Brendan Reynolds"
> <brenr...@discussions.microsoft.com> wrote:
>> They're just constants, in SQL use the literal values. 0 =
>> vbBinaryCompare,
>> 1 = vbTextCompare, 2 = vbDatabaseCompare. You can find these values in
>> the
>> Object Browser or just print them in the Immediate Window ...
>>
>> ? vbBinaryCompare
>> 0
>> ? vbTextCompare
>> 1
>> ? vbDatabaseCompare
>> 2
>>
>> I can't promise that this will work, as I wouldn't know how to go about
>> entering Japanese characters in order to test it. But it may be worth a
>> try.
>>
>> --
>> Brendan Reynolds
>> Access MVP
>>
>> "." <mr.humph...@gmail.com> wrote in
>> messagenews:(E-Mail Removed)...
>>
>>
>>
>> > Since it's embedded in SQL access doesn't support the
>> > vbTextCompare/vbBinaryCompare option.

>>
>> > On Dec 6, 5:07 pm, "Brendan Reynolds"
>> > <brenr...@discussions.microsoft.com> wrote:
>> >> Does it make any difference if you specify the optional arguments? For
>> >> example ...

>>
>> >> Mid( '?ab', Instr(1, '?ab', 'a', vbTextCompare), 1)

>>
>> >> ... or ...

>>
>> >> Mid( '?ab', Instr(1, '?ab', 'a', vbBinaryCompare), 1)

>>
>> >> ... or ...

>>
>> >> Mid( '?ab', Instr(1, '?ab', 'a', vbDatabaseCompare), 1)

>>
>> >> --
>> >> Brendan Reynolds
>> >> Access MVP

>>
>> >> "." <mr.humph...@gmail.com> wrote in
>> >> messagenews:(E-Mail Removed)...
>> >> The Instr function will return an incorrect substring position for
>> >> values containing some Japanese characters. While most Japanese
>> >> characters are fine, some characters such as ?(GU - \u30b0) and
>> >> ?(PU \u30D7) will be counted as two characters by the Instr function
>> >> offsetting the returned position incorrectly. Most importantly, the
>> >> returned position is incorrect even when passed as an argument to the
>> >> Mid function. Most other Japanese characters function correctly when
>> >> passed to the Instr function.

>>
>> >> For example,
>> >> Mid( '?ab', Instr('?ab', 'a'), 1)
>> >> will incorrectly return 'b'. With most other Japanese characters,
>> >> 'a' would be correctly returned.

>>
>> >> Is this a known problem? Is there some way to work around this?

>>
>> >> thanks

>>
>> >> mike- Hide quoted text -- Show quoted text -

>



 
Reply With Quote
 
.
Guest
Posts: n/a
 
      7th Dec 2006
Interesting. I get #Error if I add a 3rd argument.

select instr(machine,'a') from sessionRun gives the position found
select instr(machine,'a',1) from sessionRun gives #Error

sessionRun is a Text field, 255 characters.

I'm using Access 2003

thanks,

mike


On Dec 7, 3:54 pm, "Brendan Reynolds"
<brenr...@discussions.microsoft.com> wrote:
> Works for me ...
>
> SELECT Customers.CompanyName, InStr(1,[CompanyName],"e",1) AS Expr1
> FROM Customers;
>
> --
> Brendan Reynolds
> Access MVP
>
> "." <mr.humph...@gmail.com> wrote in messagenews:(E-Mail Removed)...
>
>
>
> > Yes, but the constants are not accepted inside a sql clause either.

>
> > thanks,

>
> > mike

>
> > On Dec 7, 5:03 am, "Brendan Reynolds"
> > <brenr...@discussions.microsoft.com> wrote:
> >> They're just constants, in SQL use the literal values. 0 =
> >> vbBinaryCompare,
> >> 1 = vbTextCompare, 2 = vbDatabaseCompare. You can find these values in
> >> the
> >> Object Browser or just print them in the Immediate Window ...

>
> >> ? vbBinaryCompare
> >> 0
> >> ? vbTextCompare
> >> 1
> >> ? vbDatabaseCompare
> >> 2

>
> >> I can't promise that this will work, as I wouldn't know how to go about
> >> entering Japanese characters in order to test it. But it may be worth a
> >> try.

>
> >> --
> >> Brendan Reynolds
> >> Access MVP

>
> >> "." <mr.humph...@gmail.com> wrote in
> >> messagenews:(E-Mail Removed)...

>
> >> > Since it's embedded in SQL access doesn't support the
> >> > vbTextCompare/vbBinaryCompare option.

>
> >> > On Dec 6, 5:07 pm, "Brendan Reynolds"
> >> > <brenr...@discussions.microsoft.com> wrote:
> >> >> Does it make any difference if you specify the optional arguments? For
> >> >> example ...

>
> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbTextCompare), 1)

>
> >> >> ... or ...

>
> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbBinaryCompare), 1)

>
> >> >> ... or ...

>
> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbDatabaseCompare), 1)

>
> >> >> --
> >> >> Brendan Reynolds
> >> >> Access MVP

>
> >> >> "." <mr.humph...@gmail.com> wrote in
> >> >> messagenews:(E-Mail Removed)...
> >> >> The Instr function will return an incorrect substring position for
> >> >> values containing some Japanese characters. While most Japanese
> >> >> characters are fine, some characters such as ?(GU - \u30b0) and
> >> >> ?(PU \u30D7) will be counted as two characters by the Instr function
> >> >> offsetting the returned position incorrectly. Most importantly, the
> >> >> returned position is incorrect even when passed as an argument to the
> >> >> Mid function. Most other Japanese characters function correctly when
> >> >> passed to the Instr function.

>
> >> >> For example,
> >> >> Mid( '?ab', Instr('?ab', 'a'), 1)
> >> >> will incorrectly return 'b'. With most other Japanese characters,
> >> >> 'a' would be correctly returned.

>
> >> >> Is this a known problem? Is there some way to work around this?

>
> >> >> thanks

>
> >> >> mike- Hide quoted text -- Show quoted text -- Hide quoted text -- Show quoted text -


 
Reply With Quote
 
Brendan Reynolds
Guest
Posts: n/a
 
      8th Dec 2006
You need to specify the first, 'start' argument, which is otherwise
optional, when specifying the 'compare' argument ...

select instr(1,machine,'a',1) from sessionRun

Here's a link to the on-line help topic ...

http://msdn.microsoft.com/library/de...vafctinstr.asp

--
Brendan Reynolds
Access MVP

"." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Interesting. I get #Error if I add a 3rd argument.
>
> select instr(machine,'a') from sessionRun gives the position found
> select instr(machine,'a',1) from sessionRun gives #Error
>
> sessionRun is a Text field, 255 characters.
>
> I'm using Access 2003
>
> thanks,
>
> mike
>
>
> On Dec 7, 3:54 pm, "Brendan Reynolds"
> <brenr...@discussions.microsoft.com> wrote:
>> Works for me ...
>>
>> SELECT Customers.CompanyName, InStr(1,[CompanyName],"e",1) AS Expr1
>> FROM Customers;
>>
>> --
>> Brendan Reynolds
>> Access MVP
>>
>> "." <mr.humph...@gmail.com> wrote in
>> messagenews:(E-Mail Removed)...
>>
>>
>>
>> > Yes, but the constants are not accepted inside a sql clause either.

>>
>> > thanks,

>>
>> > mike

>>
>> > On Dec 7, 5:03 am, "Brendan Reynolds"
>> > <brenr...@discussions.microsoft.com> wrote:
>> >> They're just constants, in SQL use the literal values. 0 =
>> >> vbBinaryCompare,
>> >> 1 = vbTextCompare, 2 = vbDatabaseCompare. You can find these values in
>> >> the
>> >> Object Browser or just print them in the Immediate Window ...

>>
>> >> ? vbBinaryCompare
>> >> 0
>> >> ? vbTextCompare
>> >> 1
>> >> ? vbDatabaseCompare
>> >> 2

>>
>> >> I can't promise that this will work, as I wouldn't know how to go
>> >> about
>> >> entering Japanese characters in order to test it. But it may be worth
>> >> a
>> >> try.

>>
>> >> --
>> >> Brendan Reynolds
>> >> Access MVP

>>
>> >> "." <mr.humph...@gmail.com> wrote in
>> >> messagenews:(E-Mail Removed)...

>>
>> >> > Since it's embedded in SQL access doesn't support the
>> >> > vbTextCompare/vbBinaryCompare option.

>>
>> >> > On Dec 6, 5:07 pm, "Brendan Reynolds"
>> >> > <brenr...@discussions.microsoft.com> wrote:
>> >> >> Does it make any difference if you specify the optional arguments?
>> >> >> For
>> >> >> example ...

>>
>> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbTextCompare), 1)

>>
>> >> >> ... or ...

>>
>> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbBinaryCompare), 1)

>>
>> >> >> ... or ...

>>
>> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbDatabaseCompare), 1)

>>
>> >> >> --
>> >> >> Brendan Reynolds
>> >> >> Access MVP

>>
>> >> >> "." <mr.humph...@gmail.com> wrote in
>> >> >> messagenews:(E-Mail Removed)...
>> >> >> The Instr function will return an incorrect substring position for
>> >> >> values containing some Japanese characters. While most Japanese
>> >> >> characters are fine, some characters such as ?(GU - \u30b0) and
>> >> >> ?(PU \u30D7) will be counted as two characters by the Instr
>> >> >> function
>> >> >> offsetting the returned position incorrectly. Most importantly,
>> >> >> the
>> >> >> returned position is incorrect even when passed as an argument to
>> >> >> the
>> >> >> Mid function. Most other Japanese characters function correctly
>> >> >> when
>> >> >> passed to the Instr function.

>>
>> >> >> For example,
>> >> >> Mid( '?ab', Instr('?ab', 'a'), 1)
>> >> >> will incorrectly return 'b'. With most other Japanese characters,
>> >> >> 'a' would be correctly returned.

>>
>> >> >> Is this a known problem? Is there some way to work around this?

>>
>> >> >> thanks

>>
>> >> >> mike- Hide quoted text -- Show quoted text -- Hide quoted text --
>> >> >> Show quoted text -

>



 
Reply With Quote
 
.
Guest
Posts: n/a
 
      8th Dec 2006
Great! Thanks for the help.

It works fine with textCompare and binaryCompare, only fails with
databaseCompare.

thanks,

mike

Brendan Reynolds wrote:
> You need to specify the first, 'start' argument, which is otherwise
> optional, when specifying the 'compare' argument ...
>
> select instr(1,machine,'a',1) from sessionRun
>
> Here's a link to the on-line help topic ...
>
> http://msdn.microsoft.com/library/de...vafctinstr.asp
>
> --
> Brendan Reynolds
> Access MVP
>
> "." <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Interesting. I get #Error if I add a 3rd argument.
> >
> > select instr(machine,'a') from sessionRun gives the position found
> > select instr(machine,'a',1) from sessionRun gives #Error
> >
> > sessionRun is a Text field, 255 characters.
> >
> > I'm using Access 2003
> >
> > thanks,
> >
> > mike
> >
> >
> > On Dec 7, 3:54 pm, "Brendan Reynolds"
> > <brenr...@discussions.microsoft.com> wrote:
> >> Works for me ...
> >>
> >> SELECT Customers.CompanyName, InStr(1,[CompanyName],"e",1) AS Expr1
> >> FROM Customers;
> >>
> >> --
> >> Brendan Reynolds
> >> Access MVP
> >>
> >> "." <mr.humph...@gmail.com> wrote in
> >> messagenews:(E-Mail Removed)...
> >>
> >>
> >>
> >> > Yes, but the constants are not accepted inside a sql clause either.
> >>
> >> > thanks,
> >>
> >> > mike
> >>
> >> > On Dec 7, 5:03 am, "Brendan Reynolds"
> >> > <brenr...@discussions.microsoft.com> wrote:
> >> >> They're just constants, in SQL use the literal values. 0 =
> >> >> vbBinaryCompare,
> >> >> 1 = vbTextCompare, 2 = vbDatabaseCompare. You can find these values in
> >> >> the
> >> >> Object Browser or just print them in the Immediate Window ...
> >>
> >> >> ? vbBinaryCompare
> >> >> 0
> >> >> ? vbTextCompare
> >> >> 1
> >> >> ? vbDatabaseCompare
> >> >> 2
> >>
> >> >> I can't promise that this will work, as I wouldn't know how to go
> >> >> about
> >> >> entering Japanese characters in order to test it. But it may be worth
> >> >> a
> >> >> try.
> >>
> >> >> --
> >> >> Brendan Reynolds
> >> >> Access MVP
> >>
> >> >> "." <mr.humph...@gmail.com> wrote in
> >> >> messagenews:(E-Mail Removed)...
> >>
> >> >> > Since it's embedded in SQL access doesn't support the
> >> >> > vbTextCompare/vbBinaryCompare option.
> >>
> >> >> > On Dec 6, 5:07 pm, "Brendan Reynolds"
> >> >> > <brenr...@discussions.microsoft.com> wrote:
> >> >> >> Does it make any difference if you specify the optional arguments?
> >> >> >> For
> >> >> >> example ...
> >>
> >> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbTextCompare), 1)
> >>
> >> >> >> ... or ...
> >>
> >> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbBinaryCompare), 1)
> >>
> >> >> >> ... or ...
> >>
> >> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbDatabaseCompare), 1)
> >>
> >> >> >> --
> >> >> >> Brendan Reynolds
> >> >> >> Access MVP
> >>
> >> >> >> "." <mr.humph...@gmail.com> wrote in
> >> >> >> messagenews:(E-Mail Removed)...
> >> >> >> The Instr function will return an incorrect substring position for
> >> >> >> values containing some Japanese characters. While most Japanese
> >> >> >> characters are fine, some characters such as ?(GU - \u30b0) and
> >> >> >> ?(PU \u30D7) will be counted as two characters by the Instr
> >> >> >> function
> >> >> >> offsetting the returned position incorrectly. Most importantly,
> >> >> >> the
> >> >> >> returned position is incorrect even when passed as an argument to
> >> >> >> the
> >> >> >> Mid function. Most other Japanese characters function correctly
> >> >> >> when
> >> >> >> passed to the Instr function.
> >>
> >> >> >> For example,
> >> >> >> Mid( '?ab', Instr('?ab', 'a'), 1)
> >> >> >> will incorrectly return 'b'. With most other Japanese characters,
> >> >> >> 'a' would be correctly returned.
> >>
> >> >> >> Is this a known problem? Is there some way to work around this?
> >>
> >> >> >> thanks
> >>
> >> >> >> mike- Hide quoted text -- Show quoted text -- Hide quoted text --
> >> >> >> Show quoted text -

> >


 
Reply With Quote
 
Brendan Reynolds
Guest
Posts: n/a
 
      8th Dec 2006

Cool, thanks for letting us know that it worked.

--
Brendan Reynolds
Access MVP


"." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Great! Thanks for the help.
>
> It works fine with textCompare and binaryCompare, only fails with
> databaseCompare.
>
> thanks,
>
> mike
>
> Brendan Reynolds wrote:
>> You need to specify the first, 'start' argument, which is otherwise
>> optional, when specifying the 'compare' argument ...
>>
>> select instr(1,machine,'a',1) from sessionRun
>>
>> Here's a link to the on-line help topic ...
>>
>> http://msdn.microsoft.com/library/de...vafctinstr.asp
>>
>> --
>> Brendan Reynolds
>> Access MVP
>>
>> "." <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Interesting. I get #Error if I add a 3rd argument.
>> >
>> > select instr(machine,'a') from sessionRun gives the position found
>> > select instr(machine,'a',1) from sessionRun gives #Error
>> >
>> > sessionRun is a Text field, 255 characters.
>> >
>> > I'm using Access 2003
>> >
>> > thanks,
>> >
>> > mike
>> >
>> >
>> > On Dec 7, 3:54 pm, "Brendan Reynolds"
>> > <brenr...@discussions.microsoft.com> wrote:
>> >> Works for me ...
>> >>
>> >> SELECT Customers.CompanyName, InStr(1,[CompanyName],"e",1) AS Expr1
>> >> FROM Customers;
>> >>
>> >> --
>> >> Brendan Reynolds
>> >> Access MVP
>> >>
>> >> "." <mr.humph...@gmail.com> wrote in
>> >> messagenews:(E-Mail Removed)...
>> >>
>> >>
>> >>
>> >> > Yes, but the constants are not accepted inside a sql clause either.
>> >>
>> >> > thanks,
>> >>
>> >> > mike
>> >>
>> >> > On Dec 7, 5:03 am, "Brendan Reynolds"
>> >> > <brenr...@discussions.microsoft.com> wrote:
>> >> >> They're just constants, in SQL use the literal values. 0 =
>> >> >> vbBinaryCompare,
>> >> >> 1 = vbTextCompare, 2 = vbDatabaseCompare. You can find these values
>> >> >> in
>> >> >> the
>> >> >> Object Browser or just print them in the Immediate Window ...
>> >>
>> >> >> ? vbBinaryCompare
>> >> >> 0
>> >> >> ? vbTextCompare
>> >> >> 1
>> >> >> ? vbDatabaseCompare
>> >> >> 2
>> >>
>> >> >> I can't promise that this will work, as I wouldn't know how to go
>> >> >> about
>> >> >> entering Japanese characters in order to test it. But it may be
>> >> >> worth
>> >> >> a
>> >> >> try.
>> >>
>> >> >> --
>> >> >> Brendan Reynolds
>> >> >> Access MVP
>> >>
>> >> >> "." <mr.humph...@gmail.com> wrote in
>> >> >> messagenews:(E-Mail Removed)...
>> >>
>> >> >> > Since it's embedded in SQL access doesn't support the
>> >> >> > vbTextCompare/vbBinaryCompare option.
>> >>
>> >> >> > On Dec 6, 5:07 pm, "Brendan Reynolds"
>> >> >> > <brenr...@discussions.microsoft.com> wrote:
>> >> >> >> Does it make any difference if you specify the optional
>> >> >> >> arguments?
>> >> >> >> For
>> >> >> >> example ...
>> >>
>> >> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbTextCompare), 1)
>> >>
>> >> >> >> ... or ...
>> >>
>> >> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbBinaryCompare), 1)
>> >>
>> >> >> >> ... or ...
>> >>
>> >> >> >> Mid( '?ab', Instr(1, '?ab', 'a', vbDatabaseCompare), 1)
>> >>
>> >> >> >> --
>> >> >> >> Brendan Reynolds
>> >> >> >> Access MVP
>> >>
>> >> >> >> "." <mr.humph...@gmail.com> wrote in
>> >> >> >> messagenews:(E-Mail Removed)...
>> >> >> >> The Instr function will return an incorrect substring position
>> >> >> >> for
>> >> >> >> values containing some Japanese characters. While most Japanese
>> >> >> >> characters are fine, some characters such as ?(GU - \u30b0) and
>> >> >> >> ?(PU \u30D7) will be counted as two characters by the Instr
>> >> >> >> function
>> >> >> >> offsetting the returned position incorrectly. Most importantly,
>> >> >> >> the
>> >> >> >> returned position is incorrect even when passed as an argument
>> >> >> >> to
>> >> >> >> the
>> >> >> >> Mid function. Most other Japanese characters function correctly
>> >> >> >> when
>> >> >> >> passed to the Instr function.
>> >>
>> >> >> >> For example,
>> >> >> >> Mid( '?ab', Instr('?ab', 'a'), 1)
>> >> >> >> will incorrectly return 'b'. With most other Japanese
>> >> >> >> characters,
>> >> >> >> 'a' would be correctly returned.
>> >>
>> >> >> >> Is this a known problem? Is there some way to work around this?
>> >>
>> >> >> >> thanks
>> >>
>> >> >> >> mike- Hide quoted text -- Show quoted text -- Hide quoted
>> >> >> >> text --
>> >> >> >> Show quoted text -
>> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using InStr to find a range of ASCII characters Albert S. Microsoft Access 7 14th May 2010 01:02 AM
Access Query - INSTR function? William Microsoft Access Getting Started 2 9th Jul 2008 11:41 PM
Loading data with Japanese characters in an (European) Access Data =?Utf-8?B?RGlldHJpY2ggU2Now6RmZmxlcg==?= Microsoft Access 0 13th Nov 2006 04:14 PM
is there reverse instr function in microsoft access =?Utf-8?B?QW1qYWQ=?= Microsoft Access Queries 3 10th May 2004 02:53 PM
InStr Function for Access 97 Rachel Microsoft Access VBA Modules 3 6th Nov 2003 04:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:39 PM.