Unicodes in filter expressions

B

Bill

XP SP3 - Off2003 Pro

I have a table that contains a special flag
character for special conditions or status.
It happens, for special reasons, to be
a Unicode ChrW(9658). When I attempt
to filter a recordset to only those records
that contain that flag, I get an empty set.

E.g.,
In the OnOpen code.............
Me.Filter = "[FamilySelect] = " & ChrW(9658)
Me.FilterOn

The implication is that queries do not support
Unicode characters, as I attempted to run the
query directly by inserting the Unicode character
in the criteria by cut/paste of the character from
one of the table entries that included the special
character.

Are there some hidden restrictions here?
 
B

Bob Quintal

Make that: Me.FilterOn = True

Bill said:
XP SP3 - Off2003 Pro

I have a table that contains a special flag
character for special conditions or status.
It happens, for special reasons, to be
a Unicode ChrW(9658). When I attempt
to filter a recordset to only those records
that contain that flag, I get an empty set.

E.g.,
In the OnOpen code.............
Me.Filter = "[FamilySelect] = " & ChrW(9658)
Me.FilterOn

The implication is that queries do not support
Unicode characters, as I attempted to run the
query directly by inserting the Unicode character
in the criteria by cut/paste of the character from
one of the table entries that included the special
character.

Are there some hidden restrictions here?
Only the standard restriction that any characters in VB created
strings need special quoting.
Me.Filter = "[FamilySelect] = '" & ChrW(9658) & "'"

Also, is the symbol the only character in your [familySelect] for
the records you want returned?
If there are multiple selections, you'll need to use the like
operator
Me.Filter = "[FamilySelect] Like '*" & ChrW(9658) & "*'"
 
B

Bill

Thanks Bob.

There were two problems:

The filter expression needed to be written:

Me.Filter = "[FamilySelect] = " & """" & ChrW(9658) & """"

as you pointed out.

But what was obscuring finding that problem in the first
place was that the test table was lacking other criteria
thereby excluding all records.

Thanks again,
Bill


Bob Quintal said:
Make that: Me.FilterOn = True

Bill said:
XP SP3 - Off2003 Pro

I have a table that contains a special flag
character for special conditions or status.
It happens, for special reasons, to be
a Unicode ChrW(9658). When I attempt
to filter a recordset to only those records
that contain that flag, I get an empty set.

E.g.,
In the OnOpen code.............
Me.Filter = "[FamilySelect] = " & ChrW(9658)
Me.FilterOn

The implication is that queries do not support
Unicode characters, as I attempted to run the
query directly by inserting the Unicode character
in the criteria by cut/paste of the character from
one of the table entries that included the special
character.

Are there some hidden restrictions here?
Only the standard restriction that any characters in VB created
strings need special quoting.
Me.Filter = "[FamilySelect] = '" & ChrW(9658) & "'"

Also, is the symbol the only character in your [familySelect] for
the records you want returned?
If there are multiple selections, you'll need to use the like
operator
Me.Filter = "[FamilySelect] Like '*" & ChrW(9658) & "*'"
 

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