devxlogo

Use Underscores When Dealing With Long Strings

Use Underscores When Dealing With Long Strings

Question:

Why do I get an “unterminated string constant” error message in this code?

Answer:

You can’t let your strings wrap onto multiple lines without using a continuation character. The continuation character is the underscore character, and you can build a long string like this:

rs.Open "select job_description " _   & "from job_code_table " _   & "where job_code = 'X123'", connString

devx-admin

Share the Post: