i have a navigation button that uses gotorecord acnext function. only when i get to the last record it adds a record to my table. how do i prevent this from happening.
tia
jeff
It is not adding any record it just has a new record display so you can enter a new record. as long you do not add info this record will be empty and is not considered part of the table.
After you need to have a place were to enter your next record. If you will run a Dcount on your table you will see that the last record is not in the count.
After a great deal of searching and tying many different things, I found the code below as a way to stop at the last record.
Dim intNewRecord As Integer
Forms![Wine SF1]![sf-Wines].SetFocus
DoCmd.GoToRecord , , acNext
intNewRecord = IsNull(Forms![Wine SF1]![sf-Wines]![WinesID])
If intNewRecord Then
DoCmd.GoToRecord , , acLast
MsgBox "You are at the Last of Record!"
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.