How do I search for a TAB in a field in a query?

D

DennisT

I have a column that has irregular TABs at the end of the data element. The
length of the string is counting the tab. How do I search for a TAB in the
column? I know in Excel you would use {TAB}, but Access doesn't like this.
Thanks.
 
M

Marshall Barton

DennisT said:
I have a column that has irregular TABs at the end of the data element. The
length of the string is counting the tab. How do I search for a TAB in the
column? I know in Excel you would use {TAB}, but Access doesn't like this.


Tab is Chr(9)

You can use the InStr function to locate a character in a
string pos = InStr(string, Chr(9))

You can use Like if you just want to know if there is a tab
somewhere in a string If string Like "*" & Chr(9) & "*"

You can use the Replace function to remove the tab
characters Replace(string, Chr(9), "")
or change the tabs to some other chatacter
Replace(string, Chr(9), "x")
 
Top