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
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