This should be easy for most people, just i guess im having a brain skip. I need to make a query to pull the last 2 entries in a table. What is the easiest way to be able to do this? Told ya it was easy, but its late on Sunday lol.
Do the records have a field with an incrementing ID number? If so, create a query that sorts descending on the ID field and set the query properties to "Top 2".
No I guess i Should have explained it a little better. Ok this query is to feed a chart on a report. What this report is for is to show the differences between this inspection and the last inspection in a bar graph format. Now this query's data is generated from 3 different tables. The 3rd table does have an ID number but its not sequencial so i just need to print information from this inspection and the one prior is that makes sense.
You'll need a field by which you can sort. Just use that field in place of the autonumber field in the first suggestion and you'll be able to take care of this.
Access tables do not store records in the order in which they were entered, so do be careful to create your own way of tracking the order in which your records are entered, if this will be of importance to you. A date field or an autonumber will do just fine for this.
Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995
Ok, i have a field that has date of the inspection which i can use as a basis for sorting, I am a little confused however about the "Top 2 " statement in the first comment. Can someone please elaborate on this a bit? So far everything is working except i cannot limit the bar graph to just th last 2 inspections, instead it graphs them all.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.