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

Create records in Access

Status
Not open for further replies.

bethm

Technical User
Nov 1, 2001
4
US

I am building an Access database that constantly requires maintenance. To the best of my knowledge, the only way you can create a new record in Access is to select the "new record" command, and that will place your new record at the end of the record set. I need to be able to "sandwich in" new records between already existing records. Does anyone know how to do this?
 
Access doesn't store records in any particular order. Go ahead and add the record "at the end". You can later display the table in any sorted order that you need. Maq B-)
<insert witty signature here>
 
This code would go into your AfterUpdate event. The lngPKId is your Primary key field so whatever you named it use it here.

Now whatever your PKField is on your form would be equal to MyPKID. I am assuming that in your VB References you have DAO installed?

Dim lngPKId As Long

lngPKId = Me(&quot;MYPKID&quot;)

Me.Requery

With Me.RecordsetClone
.FindFirst &quot;MYPKID = &quot; & lngPKId
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With

jaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top