VB code help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone help me with the VB code to do the following: VB code to retrieve the record with the highest autonumber primary key, and make it the current record on the form?

Thanks. EdS
 
Hi,
Something like this:
Dim lngId As Long

lngId = DMax("yourId","yourTable")
Me.recordsetClone.FindFirst "yourId = " & lngId
Me.Bookmark = Me.recordsetClone.Bookmark

Just substitute the real names for the field and table

Dan Artuso, MVP

EdS said:
Can someone help me with the VB code to do the following: VB code to retrieve the record with the highest autonumber primary
key, and make it the current record on the form?
 
Back
Top