Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • I'll note, that you shouldn't really require the & vbCrLf in each line. The compiler doesn't care about new lines. Unless of course, you really need to print out the query for viewing. In any case, vbNewLine would be the preferred anyway. Commented May 28, 2012 at 16:19
  • @codeslave: the vbcrlf is to make the query string more readable and understandable for me and any future programmer. I'll amend my code and use vbnewline ... Commented May 28, 2012 at 16:48
  • 1
    @CodeSlave Why do you prefer vbNewLine instead of vbCrLf? Commented May 28, 2012 at 17:06
  • vbCrLf is a hard coded carriage return and line feed [Chr(13) + Chr(10)]; vbNewLine is a platform-specific new line character, either [Chr(13) + Chr(10)] or [Chr(13)]. codespecs.blogspot.ca/2011/12/… It's kind of like \n in C. Conceivably, MS could release a version of MS Access for a non-Windows OS. In which case the first would break, and but the second should work without modification. vbNewLine is more descriptive of what it actually is doing. Commented May 28, 2012 at 20:22
  • Access' db engine accepts Chr(13), Chr(10), or Chr(13) & Chr(10) as line breaks in SQL statements. So regarding line breaks in queries, vbNewLine offers no advantage unless/until MS releases a version of MS Access for a non-Windows OS and changes the behavior of the db engine. Commented May 28, 2012 at 21:33