SELECT statement

  • Thread starter Thread starter JohnE
  • Start date Start date
J

JohnE

I have an embarrassing question to ask. I am having a
brain lock up in doing a SELECT statement for a
recordsource to a form. It is a long one and I can not
figure out how to break it down into shorter pieces by
taking it to the next line without the dings going off.
By leaving it one really long line it does work. Here is
the whole thing between the astericks.
*********
Forms![usrfrmClientSectionNotes].RecordSource = "SELECT
usrtblClientSectionNotes.ClientSectionNotesID,
usrtblClientSectionNotes.ClientCode,
usrtblClientSectionNotes.SectionTopic,
usrtblClientSectionNotes.DateOfEntry,
usrtblClientSectionNotes.EnteredBy,
usrtblClientSectionNotes.SectionNotes From
usrtblClientSectionNotes ORDER BY
usrtblClientSectionNotes.DateOfEntry DESC;"
*********

Can anyone help before I pull what's left of my hair out?
Thanks in advance.
*** John
 
JohnE said:
I have an embarrassing question to ask. I am having a
brain lock up in doing a SELECT statement for a
recordsource to a form. It is a long one and I can not
figure out how to break it down into shorter pieces by
taking it to the next line without the dings going off.
By leaving it one really long line it does work. Here is
the whole thing between the astericks.
*********
Forms![usrfrmClientSectionNotes].RecordSource = "SELECT
usrtblClientSectionNotes.ClientSectionNotesID,
usrtblClientSectionNotes.ClientCode,
usrtblClientSectionNotes.SectionTopic,
usrtblClientSectionNotes.DateOfEntry,
usrtblClientSectionNotes.EnteredBy,
usrtblClientSectionNotes.SectionNotes From
usrtblClientSectionNotes ORDER BY
usrtblClientSectionNotes.DateOfEntry DESC;"
*********

Can anyone help before I pull what's left of my hair out?
Thanks in advance.
*** John

The first thing you can do is shorten it by leaving the table-name
qualifier off the field names, since there's only one table involved.
Then you can break it up into bite-sized chunks concatenated together,
on separate lines with line-continuation characters. Like this:

Forms![usrfrmClientSectionNotes].RecordSource = _
"SELECT " & _
"ClientSectionNotesID, ClientCode, " & _
"SectionTopic, DateOfEntry, " & _
"EnteredBy, SectionNotes " & _
"FROM usrtblClientSectionNotes " & _
"ORDER BY DateOfEntry DESC;"
 
Dirk, it all worked. Thanks.
*** John

-----Original Message-----
JohnE said:
I have an embarrassing question to ask. I am having a
brain lock up in doing a SELECT statement for a
recordsource to a form. It is a long one and I can not
figure out how to break it down into shorter pieces by
taking it to the next line without the dings going off.
By leaving it one really long line it does work. Here is
the whole thing between the astericks.
*********
Forms![usrfrmClientSectionNotes].RecordSource = "SELECT
usrtblClientSectionNotes.ClientSectionNotesID,
usrtblClientSectionNotes.ClientCode,
usrtblClientSectionNotes.SectionTopic,
usrtblClientSectionNotes.DateOfEntry,
usrtblClientSectionNotes.EnteredBy,
usrtblClientSectionNotes.SectionNotes From
usrtblClientSectionNotes ORDER BY
usrtblClientSectionNotes.DateOfEntry DESC;"
*********

Can anyone help before I pull what's left of my hair out?
Thanks in advance.
*** John

The first thing you can do is shorten it by leaving the table-name
qualifier off the field names, since there's only one table involved.
Then you can break it up into bite-sized chunks concatenated together,
Forms![usrfrmClientSectionNotes].RecordSource = _
"SELECT " & _
"ClientSectionNotesID, ClientCode, " & _
"SectionTopic, DateOfEntry, " & _
"EnteredBy, SectionNotes " & _
"FROM usrtblClientSectionNotes " & _
"ORDER BY DateOfEntry DESC;"

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 
Back
Top