Multiple line statement

  • Thread starter Thread starter Jonh Paul
  • Start date Start date
J

Jonh Paul

Hi,

I've been looking for the symbols that will allow me to
make a multiple line SQL statement.

Can anyone point me in the right direction.

Thanks

John
 
I have just replied to another similar thread. The reply is as follows:

Try:

Me.RecordSource = "SELECT ET.EquipmentTypeID, D.Description, ET.Model, " & _
" M.Manufacturer, ET.CommonName, ET.GroupID, G.Group, " & _
" ET.VerificationProtocol, ET.TimeAllocated, ET.ElectricalClass, " & _
" ENP.EquipmentNotePath, PP.Photopath " & _
" FROM tblPhotopath AS PP " & _
" INNER JOIN (tblManufacturer AS M " & _
" INNER JOIN (tblGroup AS G " & _
" INNER JOIN (tblEquipmentNotePath AS ENP " & _
" INNER JOIN (tblDescription AS D " & _
" INNER JOIN tblEquipmentType AS ET " & _
" ON D.DescriptionID = ET.DescriptionID) " & _
" ON ENP.EquipmentNotePathID = ET.EquipmentNotePathID) " & _
" ON G.GroupID = ET.GroupID) " & _
" ON M.ManufacturerID = ET.ManufacturerID) " & _
" ON PP.PhotopathID = ET.PhotopathID " & _
" WHERE ET.CommonName = '" & Me![cboCommonName] & _
"' ORDER BY D.Description, ET.Model"

Note that I used aliases to shorten the Table names as above.



Leonard Priestley said:
Albert,

Thank you for your answer. I must be missing something however, because I
can't apply the line continuation to this line of code:

Me.RecordSource = "SELECT tblEquipmentType.EquipmentTypeID,
tblDescription.Description, tblEquipmentType.Model,
tblManufacturer.Manufacturer, tblEquipmentType.CommonName,
tblEquipmentType.GroupID, tblGroup.Group,
tblEquipmentType.VerificationProtocol, tblEquipmentType.TimeAllocated,
tblEquipmentType.ElectricalClass, tblEquipmentNotePath.EquipmentNotePath,
tblPhotopath.Photopath FROM tblPhotopath INNER JOIN (tblManufacturer INNER
JOIN (tblGroup INNER JOIN (tblEquipmentNotePath INNER JOIN (tblDescription
INNER JOIN tblEquipmentType ON tblDescription.DescriptionID =
tblEquipmentType.DescriptionID) ON tblEquipmentNotePath.EquipmentNotePathID
= tblEquipmentType.EquipmentNotePathID) ON tblGroup.GroupID =
tblEquipmentType.GroupID) ON tblManufacturer.ManufacturerID =
tblEquipmentType.ManufacturerID) ON tblPhotopath.PhotopathID =
tblEquipmentType.PhotopathID WHERE tblEquipmentType.CommonName = '" &
Me![cboCommonName] & "' ORDER BY tblDescription.Description,
tblEquipmentType.Model"

Obviously it's broken into lines in the email, but in Access it is one long
line, and I guess you can see why I would like to break it up. I have tried
applying space+underscore at places like "INNER JOIN", and also before
commas, but with no success.

Leonard Priestley
 
-----Original Message-----
I have just replied to another similar thread. The reply is as follows:

Try:

Me.RecordSource = "SELECT ET.EquipmentTypeID, D.Description, ET.Model, " & _
" M.Manufacturer, ET.CommonName, ET.GroupID, G.Group, " & _
" ET.VerificationProtocol, ET.TimeAllocated, ET.ElectricalClass, " & _
" ENP.EquipmentNotePath, PP.Photopath " & _
" FROM tblPhotopath AS PP " & _
" INNER JOIN (tblManufacturer AS M " & _
" INNER JOIN (tblGroup AS G " & _
" INNER JOIN (tblEquipmentNotePath AS ENP " & _
" INNER JOIN (tblDescription AS D " & _
" INNER JOIN tblEquipmentType AS ET " & _
" ON D.DescriptionID = ET.DescriptionID) " & _
" ON ENP.EquipmentNotePathID = ET.EquipmentNotePathID) " & _
" ON G.GroupID = ET.GroupID) " & _
" ON M.ManufacturerID = ET.ManufacturerID) " & _
" ON PP.PhotopathID = ET.PhotopathID " & _
" WHERE ET.CommonName = '" & Me![cboCommonName] & _
"' ORDER BY D.Description, ET.Model"

Note that I used aliases to shorten the Table names as above.



Albert,

Thank you for your answer. I must be missing something however, because I
can't apply the line continuation to this line of code:

Me.RecordSource = "SELECT tblEquipmentType.EquipmentTypeID,
tblDescription.Description, tblEquipmentType.Model,
tblManufacturer.Manufacturer, tblEquipmentType.CommonName,
tblEquipmentType.GroupID, tblGroup.Group,
tblEquipmentType.VerificationProtocol, tblEquipmentType.TimeAllocated,
tblEquipmentType.ElectricalClass, tblEquipmentNotePath.EquipmentNotePath,
tblPhotopath.Photopath FROM tblPhotopath INNER JOIN (tblManufacturer INNER
JOIN (tblGroup INNER JOIN (tblEquipmentNotePath INNER JOIN (tblDescription
INNER JOIN tblEquipmentType ON tblDescription.DescriptionID =
tblEquipmentType.DescriptionID) ON tblEquipmentNotePath.EquipmentNotePathID
= tblEquipmentType.EquipmentNotePathID) ON tblGroup.GroupID =
tblEquipmentType.GroupID) ON tblManufacturer.ManufacturerID =
tblEquipmentType.ManufacturerID) ON tblPhotopath.PhotopathID =
tblEquipmentType.PhotopathID WHERE tblEquipmentType.CommonName = '" &
Me![cboCommonName] & "' ORDER BY tblDescription.Description,
tblEquipmentType.Model"

Obviously it's broken into lines in the email, but in
Access it is one
long
line, and I guess you can see why I would like to
break it up. I have
tried
applying space+underscore at places like "INNER JOIN", and also before
commas, but with no success.

Leonard Priestley

--
HTH
Van T. Dinh
MVP (Access)


Hi,

I've been looking for the symbols that will allow me to
make a multiple line SQL statement.

Can anyone point me in the right direction.

Thanks

John


.
Thanks
 
Back
Top