Link to home
Start Free TrialLog in
Avatar of bill201
bill201

asked on

how to make a queyr to delete comma in a text field in access 2010

hi

i have a lot of text field that have comma like " or , and they are not in the same place in every field  like that example:
green "
gr"een
"green
green,

and i want to make a query to delete every comma in the field how can i make it?
SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
" is not a comma
, is a comma


to delete them, use an update  query

update table
set [field]=replace(replace([field],chr(34),""),",","")

chr(34) is "
Are you talking about a Comma or a Single quote ?

If single quote ... then


UPDATE Table1 SET
WHERE (((Table1.FIELD1)=Replace([FIELD1], Chr(39)  ,"")));

mx
If double quote then


UPDATE Table1 SET
WHERE (((Table1.FIELD1)=Replace([FIELD1], Chr(34)  ,"")));
to include a where clause in the update query

" is not a comma
, is a comma

chr(34) is "

to delete them, use an update  query

update table
set [field]=replace(replace([field],chr(34),""),",","")
where instr([field],chr(34))>0 or instr([Field],",")>0







Avatar of bill201
bill201

ASKER

is dont work me
i get a message that it's update but actually i don't see any update
i speak about this kind of characters:

commas and  Quotation mark and Apostrophe

and i have at least two character in in every field
what doesn't work...


try this

update table
set [field]=replace(replace(replace([field],chr(34),""),",",""),chr(39),"")



post the query you are using,

better upload a copy of the db
Avatar of bill201

ASKER

it's don't work so i'm uploading this database but i hope that you will can open it because it have hebrew  characters

the name of this field is "subject"
calendar.zip
ok, can't get the correct ascii value of the character, you might be able to do so at your end

run this codes

Sub gChar()
Dim rs As DAO.Recordset, j As Integer, s As String
Set rs = CurrentDb.OpenRecordset("select top 1 subject from calendar where startdate='1/1/2011'")
s = rs(0)
Debug.Print s
For j = 1 To Len(s)
    Debug.Print Asc(Mid(s, j, 1))
    
Next
rs.Close
End Sub

Open in new window



look in the immediate window and copy and paste here what was printed



Avatar of bill201

ASKER

¿i get this numbers


 216
 228
 32
 225
 232
 225
 250
 32
 250
 249
 242
 216
 224

Avatar of bill201

ASKER

it's now in my time zone 4:00 am so i most to go sleep for a while (if not why wife will kill me :)
a big thanks for you and be in touch tomorrow
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
also run this modify codes

Sub gChar()
Dim rs As DAO.Recordset, j As Integer, s As String
Set rs = CurrentDb.OpenRecordset("select top 1 subject from calendar where startdate='1/1/2011'")

do until rs.eof
s = rs(0)

For j = 1 To Len(s)
    Debug.Print Asc(Mid(s, j, 1))
    
Next

rs.movenext
debug.print "xxxxxxx"
loop
rs.Close
End Sub

Open in new window



copy and post back the result here


oops, use this codes


Sub gChar()
Dim rs As DAO.Recordset, j As Integer, s As String
Set rs = CurrentDb.OpenRecordset("select top 2 subject from calendar where startdate='1/1/2011'")

do until rs.eof
s = rs(0)

For j = 1 To Len(s)
    Debug.Print Asc(Mid(s, j, 1))
    
Next

rs.movenext
debug.print "xxxxxxx"
loop
rs.Close
End Sub

Open in new window



Avatar of bill201

ASKER

235
 228
 32
 225
 232
 225
 250
 32
 250
 249
 242
 224
xxxxxxx
Avatar of bill201

ASKER

235
 228
 32
 225
 232
 225
 250
 32
 250
 249
 242
 224
xxxxxxx
 244
 248
 249
 250
 32
 229
 224
 248
 224
xxxxxxx
see this link and try to find the dec value of the character

http://ascii-table.com/windows-codepage.php?1255
see this link too


http://www.ascii.ca/cp1255.htm

http://www.ascii-codes.com/cp862.html

try this query

update calendar
set [subject]=replace(replace([subject], chr(148),""),chr(146),"")

Avatar of bill201

ASKER

i suceed with making copy and paste this charcter ¿
and then i make like this
update calendar
set [subject]=replace(subject,"¿","")
thanks very very much