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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL based form determine last record 2

Status
Not open for further replies.

tigersden

Technical User
Apr 16, 2003
81
GB
Hi,
Is there anyway to determine when you are at the last record of a form based on a SQL query?
 
If you want to return the first or last record in a set of records (a domain), you should create a query sorted as either ascending or descending and set the TopValues property to 1.

docmd.gotorecord,,aclast

is the easiest way

or bookmark

 
A starting point:
With Me.Recordset
If (.AbsolutePosition + 1) >= .RecordCount Then
MsgBox "You're at last record"
End If
End With

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi gol4,
Thanks for the info, what I was trying to do was stop the form moving to a new record.
The form is purely used for editing or reviewing existing data.

Tim
 
Set the AllowAdditions property to False

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Phvs suggestion is another option
just set the forms allowadditions property to false
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top