Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

displaying first/last records

Status
Not open for further replies.

TeddyvN

Programmer
Feb 25, 2003
28
NL
Dear all,

I have a simple form that has a selectionquery underneath in order to see the records on alphabetical order instead of by the autonumbering feature of the table.
I now would like to perform searches to for example the last record - with a "Z", but the only "last record" feature I can find points me to the last of the record ID's (of the autonumbering field)...
I would also like to see on the form a text field in which I can see that I am on record number 3 of 5 - off course within my alphabetical order...
Am I making sense?
Anybody any idea's?

Teddy
 
If you have sorted the records into alphabetical order, the last one on the form should be the last in the alphabet. I am guessing here, but it may be that you are trying to find the last order within code and you are not specifying the sort order. To find out the last record alphabetically, use the SQL query:

SELECT TOP 1 RecordID FROM MyTable ORDER BY AlphaField DESC

To find out the current & total records within a form, use the Me.Recordset.AbsolutePosition and .RecordCount properties. The RecordCount property may be -1 in DAO. If so, do a Me.Recordset.MoveLast & MoveFirst before the first time you query the value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top