Record display

M

Matt

Hi,

I have a report set up to output company information from my main
table. I then have a subreport that gets a series of notes for a
particular record, each of which is dated. However, the report is
getting really long because it is outputting the entire history. Is
there any way to make the subreport only output the two most recent
records? If that's too weird, how about just the most recent record?
I tried to see if I could find a function that would do it, but I could
not.


Thanks,
Matt
 
J

jason

Use the top function in the select statement for your
query. For example, if you want the last two dates
entered your select statement would look something like:

SELECT TOP 2 [Date]
FROM

ORDER BY [Date] DESC;

Make sure the query is ordered by the Date in descending
order so that the latest records are the ones that will
be returned. If there are 3 equal dates, then all three
will be displayed (or if there are 10 or 20, same thing -
that's the only limitation).

Jason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top