View Full Version : Most Recent Entry Only


Lily
03-05-2001, 02:13 PM
Hello,

I need to generate a report based on a form and sub-form. The main form lists company name, etc., and the sub-form lists specific contact information consecutively. Is there a way to have the report show only the last entry made on the sub-form for each company? Thanks very much for any advice or suggestions.

Lily

llkhoutx
03-06-2001, 09:05 AM
Build your recordsource with a query selecting the "Last" record via appropriate criteria.

Lily
03-06-2001, 02:35 PM
llkhoutx,

Thanks for your help. I was able to generate a query to give me the company name and the last "details" entered, however, the query results are not always correct. If you may have any suggestions? The sub-form lists date, total hours, comments. When I run the query it does give me the company, latest date, total hours (all these fields appear to be correct). However, the last field, comments, is not always putting the "last" comment in the query, but rather picking up a comment from sometimes the row above (from the record in the sub-form), sometimes two or three rows above, yet the date and hours are correct. So I am stumped if you may have any advice. Thank you very much for your help.

Lily

Alexandre
03-08-2001, 06:21 AM
Lily,

On what field do you sort to obtain the "last" record? I would say that you should first work at the level of data entry to automatically register Date() or Nom() in your table when a record is added-modified (using the after change event) after having added at DateLastModified field in your table.
Then you would select your record by building a query on two criterias: the last DateLastModified AND of course the given companyID(s)). An build your
SubReport source on this Query as llkhoutx
said.

Hope this helps
JL

Lily
03-08-2001, 02:52 PM
Just a note of thanks to you both! I did get it to work and appreciate your help very much. Alexandre...that is an idea I had not thought of, so I will try that, and thank you for your advice.

Lily