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

stay in current record

Status
Not open for further replies.

jlnewbie

Technical User
Aug 9, 2000
69
hi all! I'm still somewhat of a newbie but with your help from previous years I've been able to handle all of my db problems. thank you all
I would like my form to stay in the current record when I use the addnew record function but my form jumps to the first record on requery/update. Maybe someone sees something I don't? Hope so!! Here is my function

Private Sub NumRecords_LostFocus()
Dim indx As Integer, Nkey As Integer, returnOkay As String
indx = Me.[NumRecords]
Nkey = Me.Batch
returnOkay = MyAddFunction(indx, Nkey)
End Sub

Function MyAddFunction(indx As Integer, Nkey As Integer) As String
Dim RSMT As DAO.Recordset, indx1 As Integer
Set RSMT = CurrentDb.OpenRecordset("tblSampleCylinders", dbOpenDynaset)

For indx1 = 1 To indx
RSMT.AddNew
RSMT![Batch] = Nkey
RSMT.Update
Next indx1
RSMT.Close
MyAddFunction = "Aokay"

End Function




JLopez
Lopez31@ATC-Enviro.com
Environmental Services @ Your Service
 
It is best to save the ID of the current record, requery and then find the record based on the saved ID.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top