Relatively simple Access question...

raptor13

Golden Member
Oct 9, 1999
1,719
0
76
I'm working with an Access database which is constantly being updated. New, current values are appended to the database and show up in the last row of data.

I'm using Excel to pull the data out of Access, which is no problem, except I'm only interested in the most current values, i.e. the last row, of the database. While Excel has data filtering and whatnot to sort/filter data coming from Access, I can't just choose to import the last row.

Surely there's a simple way to do this and I'm just not seeing it. How can it be done?

:gift:
 

Traire

Senior member
Feb 4, 2005
361
0
0
Create a query in Access and have it select just the last record from whatever table you want. Then have your excell file pull from that query instead of the table.
 

WannaFly

Platinum Member
Jan 14, 2003
2,811
1
0
unless theres an auto increment field, timestamp, or similar, there isnt technically a 'last row'
 

raptor13

Golden Member
Oct 9, 1999
1,719
0
76
Originally posted by: WannaFly
unless theres an auto increment field, timestamp, or similar, there isnt technically a 'last row'

I do have timestamps. The point, though, is that I want the most current row which, effectively, is the last one whether it's labeled that way or not. I do see what you're saying, though.

Originally posted by: Traire
Create a query in Access and have it select just the last record from whatever table you want. Then have your excell file pull from that query instead of the table.

Right but how do I tell it to select the last record? And, on top of that, how do I tell it to select the last record when the last record is always changing?
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Originally posted by: raptor13
Originally posted by: WannaFly
unless theres an auto increment field, timestamp, or similar, there isnt technically a 'last row'

I do have timestamps. The point, though, is that I want the most current row which, effectively, is the last one whether it's labeled that way or not. I do see what you're saying, though.

Originally posted by: Traire
Create a query in Access and have it select just the last record from whatever table you want. Then have your excell file pull from that query instead of the table.

Right but how do I tell it to select the last record? And, on top of that, how do I tell it to select the last record when the last record is always changing?

You should generate an index that is unique and always increasing as WannaFly implied.

Have the query sort on the index and Move to the last record.

Or setup a second table that has the index always updated.
Run a specific query against the main table with the index matching the value stored in the second table (which has the most current index).

 

Gunslinger08

Lifer
Nov 18, 2001
13,234
2
81
If Access or Excel can run SQL Queries do it this way:

SELECT TOP 1 FROM table_name ORDER BY timestamp_name DESC