Share via

Access query - How do I replace a double & single quotation character in a field

Anonymous
2011-09-21T14:33:11+00:00

In a table I receive data that contains what appear to be both double and single quotation marks in a text field.

I set up 2 queries:

  • UPDATE CSCust SET CSCust.final_company = Replace([final_company],Chr(34),"");
  • UPDATE CSCust SET CSCust.final_company = Replace([final_company],Chr(39),"");

but the characters remain.  So what is another approach to getting rid of these characters?

Dave

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2011-09-21T23:14:00+00:00

How are you running the Update query? Note that opening it in datasheet view does NOT actually execute it - instead it shows the data prior to its execution. The ! icon on the toolbar will run the query (you should get a message box saying "this query will make permanent changes...")

I'd suggest as SQL:

UPDATE CSCust

SET CSCust.final_company = Replace(Replace([final_company], Chr(34), ""),Chr(39), "")

WHERE final_company LIKE "*" & Chr(34) & "*"

OR final_company LIKE "*" & Chr(39) & "*";

to limit the update to those records which need updating.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

9 additional answers

Sort by: Most helpful
  1. HansV 462.6K Reputation points
    2011-09-21T15:13:33+00:00

    Also replace the "curly" quotes Chr(145), Chr(146), Chr(147) and Chr(148).

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2011-09-21T17:23:52+00:00

    I did find it is a ASC 39, so why does this not fix it?

    UPDATE CSCust SET CSCust.final_company = Replace([final_company],Chr(39),"")

    WHERE (((CSCust.final_company)>''));

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2011-09-21T17:21:42+00:00

    What does the x represent?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2011-09-21T15:17:13+00:00

    First you have to determine exactly what the characters are.  There are more than one that appears to be a double quote.   Use the ASC function to find the Chr value.     Asc(Mid([TextField], x, 1))

    Was this answer helpful?

    0 comments No comments