Type Mismatch on Update Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Reedsp
    New Member
    • Apr 2007
    • 19

    Type Mismatch on Update Query

    I am trying to replace quote marks that are typed accidently by users in a table. I need to strip out the quote marks. I get a "Run Time error '13' Type mismatch" with this code. Here is the code.

    DoCmd.RunSQL "UPDATE tblMemberInfo SET tblMemberInfo.F ullName = Replace([FullName],""*" & Chr(34) & "*"","");"

    Is their a better way to search and replace quote marks without using the dialog box.
  • pks00
    Recognized Expert Contributor
    • Oct 2006
    • 280

    #2
    Originally posted by Reedsp
    I am trying to replace quote marks that are typed accidently by users in a table. I need to strip out the quote marks. I get a "Run Time error '13' Type mismatch" with this code. Here is the code.

    DoCmd.RunSQL "UPDATE tblMemberInfo SET tblMemberInfo.F ullName = Replace([FullName],""*" & Chr(34) & "*"","");"

    Is their a better way to search and replace quote marks without using the dialog box.
    Not sure what u are trying in your code there, u got an asterix in there

    If u want to replace quotation marks, can u simply not do this?

    DoCmd.RunSQL "UPDATE tblMemberInfo SET tblMemberInfo.F ullName = Replace([FullName],"'","")

    or is it double quotes u want to get rid of

    Comment

    • Reedsp
      New Member
      • Apr 2007
      • 19

      #3
      Originally posted by Reedsp
      I am trying to replace quote marks that are typed accidently by users in a table. I need to strip out the quote marks. I get a "Run Time error '13' Type mismatch" with this code. Here is the code.

      DoCmd.RunSQL "UPDATE tblMemberInfo SET tblMemberInfo.F ullName = Replace([FullName],""*" & Chr(34) & "*"","");"

      Is their a better way to search and replace quote marks without using the dialog box.
      If you use 4 quote marks then Access searches for the quote marks and replaces them with nothing.

      I found the solution: DoCmd.RunSQL "UPDATE tblMemberInfo SET tblMemberInfo.F ullName = Replace([FullName"""","" );"

      If you use the replace function in a query on the "Update to" line, it works also. Except if the field you are searching only has 1 character and its a quote mark then you recieve an error. So you need to replace the quotes with a space or a character.

      Comment

      Working...