SQL Statement in Access 2007 VBA Returning max value
Posted on 2011-10-12
I have a command button that when clicked, needs to look at a table and select the record with the highest "LotNo" number. (which is the primary key).
Once I get that number, I'm going to look at how many pounds have been assigned to it and take some action accordingly. But I think I'm ok on all of that, I am just fumbling in trying to get the highest number from the "tblLots" table using runcmd.sql statement. Probably try to make it too complicated.
I've tried so many different things I wouldn't know what to post to show.... guess I'm putting the "" marks in the wrong spot.
Table name = tblLots
"LotNo", Number, Long Integer (need to return the highest number in the table)
LotDate, Date, Short (not really using this yet)
Lbs, Number, Long Integer (if the pounds are over 10,000, then I will create a new LotNo which will be the next sequential number)
Any help is appreciated.