I would take a different view (without arguing with Colintis. His view is equally valid. Just different from mine).
I never saw a good reason for using
Chr(34) to create a string with quotes (') in. It is not easier to read unless you already use it and recognise it. I would say rather that it was harder to read as a form of translation is necessary, where it is not necessary for using the character natively. This is clearly demonstrated by the question being required in the first place. Quotes (') and double-quotes (") (See
Quotes (') and Double-Quotes (") - Where and When to use them) are easily distinguished when used correctly, either in the code window or, when posting, in the code tags, and have the benefit of showing exactly what is expected and required in the string. Only proportional fonts make '' look like ".
- Only proportional fonts make '' look like ".
I would write your code as :
- strSQL = "DELETE FROM tblA WHERE fieldA ='" & Me.Name & "'"
-
DoCmd.RunSQL strSQL, True