How Capture AutoNumber?

  • Thread starter Thread starter David Habercom
  • Start date Start date
D

David Habercom

I need to return to a record which may have a duplicate value. I assumed
that, by adding an AutoNumber field, I would have a unique handle I could
save to a variable for a quick return -- but I don't see the field
(UniqueRecID) in the field list or see how to refer to it in Basic code.
What am I missing?

Thanks in advance.

David Habercom
 
Hi,


An autonumber is NOT necessary supplying unique (no duplicated)
values. An index, or a constraint UNIQUE (which will add an index) is
required, to enforce that requirement.


If you work with recordset, as long as you do not close the
recordset, the recordset maintain a "bookmark", internally, to be able to
come back to the records.


Dim x As Variant

x=Me.Bookmark ' the actual record, such as displayed on the
form

Me.Undo ' undo any modif

With Me.RecordsetClone ' already open for you

' find the first record with the same ClientID
.FindFirst "ClientID=" & Me.ClientID

If Not .Nomatch then
Me.Bookmark = .Bookmark
'go, visually, to the found record

... do something

Me.Bookmark = x ' come back

End If
End With




Hoping it may help,
Vanderghast, Access MVP
 
Back
Top