matching special characters (mainly the '.')

G

Guest

I am trying to write a query where the select's where clause is "WHERE [Name]
like 'access.' or [Name] like '\[access\].'" but it does not work. If i
remove the '.' it works fine, but i need look for records that include that
period.

thanks for any help
ben
 
T

Tom Ellison

Dear Ben:

If you are searching for values that contain the string "access." you would
typically use some kind of wildcards. Are you searching for strings that
contain that string, or are you searching for strings that are exactly
"access."? Or are you searching for strings that begin with "access." or
end with "access."? All these alternatives are different, and require
different treatment.

Tom Ellison
 
J

John Spencer

I am not aware that the period is a wildcard character in Access. Since you
aren't using any wildcards in the string, I don't understand why you are using
the like operator instead of the equals operator.

If the period is a wildcard then you would enclose it in brackets as. Brackets
[] are special characters and as such must be bracketed.
'access[.]'


Are you doing this with Access + Jet (.mdb) or with an Access Project (.adp).
The wildcards are different between the two. Or are you trying to do this with
some other product (MS SQL, MySQL,???)?

In Access + Jet (.mdb) database then
[Name] like '\[access\].'

equates to match name if it
starts with \
has a 2nd character of a c e or s
and is followed by a period.
 
G

Guest

Im sorry if I hadn't made my question clear. I have strings (well memo
fields) that I am searching for the strings "access." OR "[access]." The
reason im doing this is for searching for crossreferences to tables so i need
to search where the string is like the above strings with wildcards on either
side.

Does this help any?

It was my beliefe that the "\" meant to match the next character once so if
i used "\[" it tried to match a "[" before continuing. I need to be able to
search for the table names with and without brackets and to have the period
at the end to know for certain its a full table name.

thanks for any and all help!
ben

John Spencer said:
I am not aware that the period is a wildcard character in Access. Since you
aren't using any wildcards in the string, I don't understand why you are using
the like operator instead of the equals operator.

If the period is a wildcard then you would enclose it in brackets as. Brackets
[] are special characters and as such must be bracketed.
'access[.]'


Are you doing this with Access + Jet (.mdb) or with an Access Project (.adp).
The wildcards are different between the two. Or are you trying to do this with
some other product (MS SQL, MySQL,???)?

In Access + Jet (.mdb) database then
[Name] like '\[access\].'

equates to match name if it
starts with \
has a 2nd character of a c e or s
and is followed by a period.

I am trying to write a query where the select's where clause is "WHERE [Name]
like 'access.' or [Name] like '\[access\].'" but it does not work. If i
remove the '.' it works fine, but i need look for records that include that
period.

thanks for any help
ben
 
J

John Spencer

If I understand your requirement correctly the criteria is probably the following.

LIKE "*Access.*" OR Like "*[[]Access].*"

That means search for "Access." anywhere in the memo field or
search for "[Access]." anywhere in the memo field

Im sorry if I hadn't made my question clear. I have strings (well memo
fields) that I am searching for the strings "access." OR "[access]." The
reason im doing this is for searching for crossreferences to tables so i need
to search where the string is like the above strings with wildcards on either
side.

Does this help any?

It was my beliefe that the "\" meant to match the next character once so if
i used "\[" it tried to match a "[" before continuing. I need to be able to
search for the table names with and without brackets and to have the period
at the end to know for certain its a full table name.

thanks for any and all help!
ben

John Spencer said:
I am not aware that the period is a wildcard character in Access. Since you
aren't using any wildcards in the string, I don't understand why you are using
the like operator instead of the equals operator.

If the period is a wildcard then you would enclose it in brackets as. Brackets
[] are special characters and as such must be bracketed.
'access[.]'


Are you doing this with Access + Jet (.mdb) or with an Access Project (.adp).
The wildcards are different between the two. Or are you trying to do this with
some other product (MS SQL, MySQL,???)?

In Access + Jet (.mdb) database then
[Name] like '\[access\].'

equates to match name if it
starts with \
has a 2nd character of a c e or s
and is followed by a period.

I am trying to write a query where the select's where clause is "WHERE [Name]
like 'access.' or [Name] like '\[access\].'" but it does not work. If i
remove the '.' it works fine, but i need look for records that include that
period.

thanks for any help
ben
 
G

Guest

Thank you. it seems to be working.

John Spencer said:
If I understand your requirement correctly the criteria is probably the following.

LIKE "*Access.*" OR Like "*[[]Access].*"

That means search for "Access." anywhere in the memo field or
search for "[Access]." anywhere in the memo field

Im sorry if I hadn't made my question clear. I have strings (well memo
fields) that I am searching for the strings "access." OR "[access]." The
reason im doing this is for searching for crossreferences to tables so i need
to search where the string is like the above strings with wildcards on either
side.

Does this help any?

It was my beliefe that the "\" meant to match the next character once so if
i used "\[" it tried to match a "[" before continuing. I need to be able to
search for the table names with and without brackets and to have the period
at the end to know for certain its a full table name.

thanks for any and all help!
ben

John Spencer said:
I am not aware that the period is a wildcard character in Access. Since you
aren't using any wildcards in the string, I don't understand why you are using
the like operator instead of the equals operator.

If the period is a wildcard then you would enclose it in brackets as. Brackets
[] are special characters and as such must be bracketed.
'access[.]'


Are you doing this with Access + Jet (.mdb) or with an Access Project (.adp).
The wildcards are different between the two. Or are you trying to do this with
some other product (MS SQL, MySQL,???)?

In Access + Jet (.mdb) database then
[Name] like '\[access\].'

equates to match name if it
starts with \
has a 2nd character of a c e or s
and is followed by a period.


Ben wrote:

I am trying to write a query where the select's where clause is "WHERE [Name]
like 'access.' or [Name] like '\[access\].'" but it does not work. If i
remove the '.' it works fine, but i need look for records that include that
period.

thanks for any help
ben
 

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