This is not necessarily easy to do because
a. SQL is not designed to pick records based on their position in an
unordered list
b. the SQL constructs available to you depend on the data source being used
However, if you know the records will be sequenced in "pc_no_seg" order,
with some dialects of SQL you might be able to use something like
"SELECT TOP 1 * FROM " & FileName & " ORDER BY pc_no_seg DESC"
or if pc_no_seg is in effect a record number you might be able to do
something along the lines of
"SELECT * FROM " & FileName & " WHERE pc_no_seg = (SELECT count(*) FROM " &
FileName & ")"
If you can't do anything like that, your best bets are probably
a. open the full data source, and use the MailMerge object model in VBA to
step through the records until you reach the last one (in my experience, you
can't always simply jump to the last record) and stuff the data in that
record into your report or
b. use another method altogether (e.g. ADO) to open your data source, and
stuff the data into your Word document.
Peter Jamieson
> Helo all,
>
[quoted text clipped - 40 lines]
> Thanx
> Dale Jones
Dale - 18 Jan 2006 18:30 GMT
Thanx so much for your response Peter. Not bieng a good programmer, I tend
to go with whatever I can make to work.
Data IS sequenced in "pc_no_seg" order and pc_no_seg IS in effect a record
number.
I'll let your comments sink in and stew a while.
Does anyone else have a suggestion?
A refresh/reiteration of my question is "What I have works." I want to
continue using it AND choose the last record of any data file I will connect
to.
> This is not necessarily easy to do because
> a. SQL is not designed to pick records based on their position in an
[quoted text clipped - 67 lines]
>> Thanx
>> Dale Jones