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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line breaking long statements

Status
Not open for further replies.

Bry12345

Programmer
Mar 3, 2002
228
US
I have a very long SQL statement in a module that needs to be broken into several lines for readability. I've added _ at the point where I wish the line to break, but I then get a compile error . . Expected: End of Statement (with 'WHERE' highlighted. The code runs fine on one line, so it's my syntax in breaking up the line.

The code that returns the error is (two lines, broken before the 'WHERE'):

strSQL = "SELECT tblMain.ID, tblMain.FileNumber, tblMain.DateIn, tblMain.EnteredBy, tblMain.Barcode1, tblMain.Barcode2, tblMain.Barcode3, tblMain.Barcode4, tblMain.Barcode5, tblMain.Barcode6, tblMain.Barcode7, tblMain.Barcode8, tblMain.Barcode9, tblMain.Barcode10, tblMain.EvidenceReturned, tblMain.Location1, tblMain.Location2, tblMain.Location3, tblMain.Location4, tblMain.Location5, tblMain.RemovedBy, tblMain.DateOut, tblMain.Comments, tblMain.Description, tblMain.ReleasedTo FROM tblMain" _
WHERE (((tblMain.EvidenceReturned)=False) AND ((tblMain.Location1) Like [Forms]![frmCurrentLocationSearchCriteria]![SearchCriteria])) OR (((tblMain.Location2) Like [Forms]![frmCurrentLocationSearchCriteria]![SearchCriteria])) OR (((tblMain.Location3) Like [Forms]![frmCurrentLocationSearchCriteria]![SearchCriteria])) OR (((tblMain.Location4) Like [Forms]![frmCurrentLocationSearchCriteria]![SearchCriteria])) OR (((tblMain.Location5) Like [Forms]![frmCurrentLocationSearchCriteria]![SearchCriteria]))"

Thanks! - - - -

Bryan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top