Scan for tab character in a column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table where some users entered tab characters in a particular column
and I have to find them and delete them. How to find them? Can I use CHR$
function?
 
UPDATE YourTable
SET YourField = Replace([YourField],Chr(13),"")
WHERE YourField Like "*" & Chr(13) & "*"


If I recall correctly a tab is Chr(13).

STANDARD ADVICE: BACK UP your data first. Then test the above.



'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
John said:
UPDATE YourTable
SET YourField = Replace([YourField],Chr(13),"")
WHERE YourField Like "*" & Chr(13) & "*"


If I recall correctly a tab is Chr(13).

Tab is Chr(9), carriage return is Chr(13).
STANDARD ADVICE: BACK UP your data first. Then test the above.


But, Tab is not something a user can enter into a
table/queryform field because it is used to terminate the
entry and move to the next field. If a user hits the tab
key without typeing anything else, the field will contain
Null, or, if the table field's AllowZeroLength property is
set to Yes, an empty string ("").

You need to make sure you know what is in the field, try
running a query to display the character's ascii code:

SELECT Asc(thefield) From thetable
 
Thanks Marshall. Had a senior moment. I knew that.

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================


Marshall said:
John said:
UPDATE YourTable
SET YourField = Replace([YourField],Chr(13),"")
WHERE YourField Like "*" & Chr(13) & "*"


If I recall correctly a tab is Chr(13).

Tab is Chr(9), carriage return is Chr(13).
STANDARD ADVICE: BACK UP your data first. Then test the above.


But, Tab is not something a user can enter into a
table/queryform field because it is used to terminate the
entry and move to the next field. If a user hits the tab
key without typeing anything else, the field will contain
Null, or, if the table field's AllowZeroLength property is
set to Yes, an empty string ("").

You need to make sure you know what is in the field, try
running a query to display the character's ascii code:

SELECT Asc(thefield) From thetable
 
Back
Top