1

Consider this simple coding in Access VBA:

Dim sql As String
sql = "SELECT * FROM 1 where [1.how] ="good""

Because of the double quote surrounding the word "good", I am getting this compile error:

"expected end of statement"

How can I avoid this problem?

HansUp
  • 95,961
  • 11
  • 77
  • 135
mohamed shubber
  • 113
  • 1
  • 14
  • double every double quotes inside the string: `sql = "SELECT * FROM 1 where [1.how] =""good"""` – user3598756 May 08 '16 at 16:04
  • thank you it worked,can you rewrite it in a separate answer so i can choose it as the right answer – mohamed shubber May 08 '16 at 16:25
  • Or you could upvote this answer: http://stackoverflow.com/a/9024764/6216216 (which this question is a duplicate of) -- after all you should have found this all by yourself by searching stackoverflow for `vba double quotes` – Leviathan May 08 '16 at 16:35

1 Answers1

1

double every double quotes inside the string:

sql = "SELECT * FROM 1 where [1.how] =""good"""

user3598756
  • 28,893
  • 4
  • 18
  • 28