Share via

SQL Statement Wrap Around Issue

Anonymous
2011-03-09T01:13:57+00:00

I am using VBA Code to develop a large SQL statement like over 1400 characters in length.  When I paste my SQL statement in a Query using SQL View, I get a wrap around issue where the statement goes to the next line in the SQL View at the wrong place that causes SQL execution issue.  If I correct the SQL wrap around in the SQL View,  the Query works.

For example Tablexxx.yyyy.   In the SQL view, the first line ends with Tablexxx.y   and the other three yyy appears on the wrap around which causes SQL execution error.   If I move Tablexxx.yyyy manually to the next line, its oK

How can I create a long SQL statement and not having the wrap around issue ???

Is it possible for me to add characters such as line feed  and still have the SQL statement work ??   I think I can check on the string length and force a line feed.     Is there a better way ???

Your help is appreciated.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
2011-03-09T02:25:45+00:00

You could write:

select [10 fields go here] & vbCrLf & [10 more fields go here] & vbCrLf & etc.

from [first join goes here] & vbCrLf

[second join goes here] & vbCrLf

etc.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful