Characters found after end of SQL Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Can anyone tell me what I am doing wrong. I am getting this error when I
try to run the following:
strSQL = "SELECT tblHouses.RollNumber,
tblCurrentMeterInformation.RollNumber, tblHouses.FirstOfHouseAddress,
tblHouses.FirstOfHouseNumber, tblHouses.FirstOfRoadName, tblHouses.MeterNo,
tblHouses.AccountNo, tblHouses.NCListNo, tblHouses.MPriority,
tblHouses.MainListNo1, tblCurrentMeterInformation.RecordingNo,
tblCurrentMeterInformation.LastSequenceNo,
tblCurrentMeterInformation.CurrentMeterNum,
tblCurrentMeterInformation.CurrentRegisterNum FROM tblHouses LEFT JOIN
tblCurrentMeterInformation ON
tblHouses.RollNumber=tblCurrentMeterInformation.RollNumber;"

Thank you,
IEJ
 
Hi,
Can anyone tell me what I am doing wrong. I am getting this error
when I try to run the following:
strSQL = "SELECT tblHouses.RollNumber,
tblCurrentMeterInformation.RollNumber, tblHouses.FirstOfHouseAddress,
tblHouses.FirstOfHouseNumber, tblHouses.FirstOfRoadName,
tblHouses.MeterNo, tblHouses.AccountNo, tblHouses.NCListNo,
tblHouses.MPriority, tblHouses.MainListNo1,
tblCurrentMeterInformation.RecordingNo,
tblCurrentMeterInformation.LastSequenceNo,
tblCurrentMeterInformation.CurrentMeterNum,
tblCurrentMeterInformation.CurrentRegisterNum FROM tblHouses LEFT
JOIN tblCurrentMeterInformation ON
tblHouses.RollNumber=tblCurrentMeterInformation.RollNumber;"

Thank you,
IEJ

Is that all on one line in your code window? If not you can't split a
string over multiple lines without delimiting each line.

strSQL = "SELECT tblHouses.RollNumber, " & _
"tblCurrentMeterInformation.RollNumber, tblHouses.FirstOfHouseAddress, " & _
"tblHouses.FirstOfHouseNumber, tblHouses.FirstOfRoadName, " & _
"tblHouses.MeterNo, tblHouses.AccountNo, tblHouses.NCListNo, " & _
"tblHouses.MPriority, tblHouses.MainListNo1, " & _
"tblCurrentMeterInformation.RecordingNo, " & _
"tblCurrentMeterInformation.LastSequenceNo, " & _
"tblCurrentMeterInformation.CurrentMeterNum, " & _
"tblCurrentMeterInformation.CurrentRegisterNum FROM tblHouses LEFT " & _
"JOIN tblCurrentMeterInformation ON " & _
"tblHouses.RollNumber=tblCurrentMeterInformation.RollNumber;"

Make sure you leave a space at the end of each line before the last one.
 
Yes, it is all on one line.

IEJ

Rick Brandt said:
Is that all on one line in your code window? If not you can't split a
string over multiple lines without delimiting each line.

strSQL = "SELECT tblHouses.RollNumber, " & _
"tblCurrentMeterInformation.RollNumber, tblHouses.FirstOfHouseAddress, " & _
"tblHouses.FirstOfHouseNumber, tblHouses.FirstOfRoadName, " & _
"tblHouses.MeterNo, tblHouses.AccountNo, tblHouses.NCListNo, " & _
"tblHouses.MPriority, tblHouses.MainListNo1, " & _
"tblCurrentMeterInformation.RecordingNo, " & _
"tblCurrentMeterInformation.LastSequenceNo, " & _
"tblCurrentMeterInformation.CurrentMeterNum, " & _
"tblCurrentMeterInformation.CurrentRegisterNum FROM tblHouses LEFT " & _
"JOIN tblCurrentMeterInformation ON " & _
"tblHouses.RollNumber=tblCurrentMeterInformation.RollNumber;"

Make sure you leave a space at the end of each line before the last one.
 
When you run this in the Debugger, is this the line that is highlighted? Do
you do anything to strSQL between this assignment and when you actually
execute it?

What does the whole subproc look like? I hope this is readable if you post
it <g>. Oh for a decent News reader!!
 
Back
Top