case sensitive filter

G

Guest

Hi, I have a text field that contains records like these:-

ABCD
Abcd
aBcd

I need to create case-sensitive filter. How can I do that?
(if I use fieldname="abcd", the system will return all records)
How to make it case-sensitive?
Thanks a lot.
Cynthia
 
A

Allen Browne

There's not an efficient way to do that.

You can use:
StrConv([MyField], 'abcd', 0) = 0
but it will not be able to use any index on the field.
 
G

Guest

Thanks Allen, but I don't really understand it.
Say, for example, I need to get the "Abcd" out from:

ABCD
aBcd
Abcd

Shall I use "Select * from
where StrConv([MyField], 'abcd', 0) = 0" ?
or anything else?
Thanks a lot

Allen Browne said:
There's not an efficient way to do that.

You can use:
StrConv([MyField], 'abcd', 0) = 0
but it will not be able to use any index on the field.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Cynthia said:
Hi, I have a text field that contains records like these:-

ABCD
Abcd
aBcd

I need to create case-sensitive filter. How can I do that?
(if I use fieldname="abcd", the system will return all records)
How to make it case-sensitive?
Thanks a lot.
Cynthia
 
A

Allen Browne

Yes, that's the idea.

JET comparisons are not case-sensitive.
The VBA function StrComp() is.
(Ah: it's StrComp(), not StrConv(). Sorry.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Cynthia said:
Thanks Allen, but I don't really understand it.
Say, for example, I need to get the "Abcd" out from:

ABCD
aBcd
Abcd

Shall I use "Select * from
where StrConv([MyField], 'abcd', 0) =
0" ?
or anything else?
Thanks a lot

Allen Browne said:
There's not an efficient way to do that.

You can use:
StrConv([MyField], 'abcd', 0) = 0
but it will not be able to use any index on the field.

Cynthia said:
Hi, I have a text field that contains records like these:-

ABCD
Abcd
aBcd

I need to create case-sensitive filter. How can I do that?
(if I use fieldname="abcd", the system will return all records)
How to make it case-sensitive?
Thanks a lot.
Cynthia
 
D

Douglas J. Steele

Actually, you'd need to use

Select * from
where StrConv([MyField], 'Abcd', 0) = 0

to get the Abcd out of your table. (StrConv([MyField], 'abcd', 0) = 0 would
get the abcd out)
--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Cynthia said:
Thanks Allen, but I don't really understand it.
Say, for example, I need to get the "Abcd" out from:

ABCD
aBcd
Abcd

Shall I use "Select * from
where StrConv([MyField], 'abcd', 0) =
0" ?
or anything else?
Thanks a lot

Allen Browne said:
There's not an efficient way to do that.

You can use:
StrConv([MyField], 'abcd', 0) = 0
but it will not be able to use any index on the field.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Cynthia said:
Hi, I have a text field that contains records like these:-

ABCD
Abcd
aBcd

I need to create case-sensitive filter. How can I do that?
(if I use fieldname="abcd", the system will return all records)
How to make it case-sensitive?
Thanks a lot.
Cynthia
 
J

John W. Vinson

I haven't been able to get the StrComp to work when using the Filter
method. I am trying:

filter = "StrCompare(Field1, "'" & string1 & "'", 0) = 0"

Can someone help me with the syntax, please?

Thanks,

Langley111

It's StrComp, not StrCompare.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top