How do I Wrap Long Lines of SQL??
How do I Wrap Long Lines of SQL??
(OP)
I can't seem to remember how to wrap a long sql statement. I am using DoCmd.RunSQL and sql cut and pasted from a query, but the line is too long. I seem to remember a way to effectively wrap this with underscores and ampersands, but it's not working. Help!
RE: How do I Wrap Long Lines of SQL??
RE: How do I Wrap Long Lines of SQL??
RE: How do I Wrap Long Lines of SQL??
DoCmd.RunSQL "SELECT * FROM tblGenericName " & _
"WHERE intA > intB"
Close off the first line with end quotes, use the ampersand to concantenate the strings and the underscore continues the same line of code...
Hope this helps,
Kyle
RE: How do I Wrap Long Lines of SQL??
Doug
RE: How do I Wrap Long Lines of SQL??
here you go
strSQL = "select FIeld1, FIeld2, FIeld3,Field4 from SomeTable "
strSQL = strSQL & "where FIeld1 like '%" & TheCriteria & "%' and "
strSQL = strSQL & "FIeld2 like '%" & SecondCriteria & "%' and "
strSQL = strSQL & "FIeld3 like '%" & thirdCriteria & "%' and "
strSQL = strSQL & "Field4 = WhateverCriteria "
strSQL = strSQL & " order by [SomeTable].FIeld1,[SomeTable].FIeld2, [SomeTable].FIeld3, [SomeTable].FIeld4"