Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with the Length of my SQL code 1

Status
Not open for further replies.

Petchy

MIS
Jan 29, 2001
6
0
0
GB
Hi All,

I currently have SQL code that is based on user defined tables. However some of the table names differ in length, the result of this is that occasionally an error is caused by the length of the query code being too long and access splits the table name so it does not recognise it.

Is the a method I can use to force access to start a new line of code or perhaps keep the table name and the field together. Any Suggestions?

Cheers,

Craig
 
You can use aliases to shorten the code.

Select
a.col1, a.col2, b.colD, b.ColW,
c.ColA, c.colU, c.colX
From (MyLongTableNameAAA As a
Inner Join MyLongTableNameBBB As b
On a.col1=b.colQ
Inner Join MyLongTableNameCCC as c
on b.colA=c.colC

You can force a new line by concatenating vbcrlf with the SQL statments.

Dim sql As String

sql = "Select a.col1, a.col2, b.colD, b.ColW," & _
" c.ColA, c.colU, c.colX" & vbcrlf & _
" From (MyLongTableNameAAA As a" & vbcrlf & _
" Inner Join MyLongTableNameBBB As b" & _
" On a.col1=b.colQ" & vbcrlf & _
" Inner Join MyLongTableNameCCC as c" & _
" on b.colA=c.colC" Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions in the SQL Server forum. Many of the ideas apply to all forums.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top