Access 2.0: SQL function "MAX" available?

  • Thread starter Thread starter =?ISO-8859-15?Q?Christian_M=FCnscher?=
  • Start date Start date
?

=?ISO-8859-15?Q?Christian_M=FCnscher?=

Hi!

A friend of mine has to cope with an Access 2.0 Database. Sometimes
there is a weird problem that makes it necessary to determine what is
the ID of the last record that has been created in a table.
In MySQL, I'd use "mysql_last_id" or try to get that ID by using the SQL
"MAX" function, assuming that the ID always is incremented.
For example, you could use "SELECT MAX(salary) as 'Highest salary'
FROM employees;" to identify the highest salary, or do a "SELECT MAX(ID)
FROM data;" to solve my problem in MySQL.
How would you do that in Access 2.0? And how would you close the "gap"
if the ID accidentally has been incremented by two (three, four) instead
of one? I think one would have to rewrite the whole table if absolutely
wanting to close that gap. Its an old 16-bit version of Visual Basic
(4.0?) his programs are coded in... Is there something like a (coding)
reference manual online for Access 2.0? Googling around didn't help me ;(

Thank you very much!

With kind regards,
Chriss
 
As far as I remember, you can use the Max function in Access 2.0. What
happens when you try?

When you're talking about gaps, is it an AutoNumber field (one that's
automatically generated for you)? If so, you can't do anything about the
gaps, but what does it matter? An AutoNumber exists for one purpose only: to
provide a (practically guaranteed) unique value that can be used as a
primary key. 1, 4, 6, 9 serves that function just as well as 1, 2, 3, 4
does.
 

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

Similar Threads

update query with DMax? 4
max autonum multi-user environment 12
Finding the date of last pay rise 8
Using TOP function 0
Group by 1
Subquery 3
conditional math 3
Finding the two biggest numbers? 5

Back
Top