I need to increment a field within a transaction block. I call a function like the following within the transaction (there is more to the function, but this is the relevant portion).
Public Function UpdateGL() As Boolean
Dim rsGL As Recordset
Dim NewGLID As Integer
Dim db as Database
Set db = CurrentDb()
Set rsGL = db.OpenRecordset("select * from [GL_Table]"
NewGLID = DMax("[GL_ID]", "[GL_Table]" + 1
With rsGL
.AddNew
![gl_id] = NewGLID
.Update
End With
End Function
If I call this function a second time within the same transaction, the counter does not increment. It stays the same as the first pass. Is there any way to access the "current" value of GL_ID without committing the transaction?
Thanks!
JD
Public Function UpdateGL() As Boolean
Dim rsGL As Recordset
Dim NewGLID As Integer
Dim db as Database
Set db = CurrentDb()
Set rsGL = db.OpenRecordset("select * from [GL_Table]"
NewGLID = DMax("[GL_ID]", "[GL_Table]" + 1
With rsGL
.AddNew
![gl_id] = NewGLID
.Update
End With
End Function
If I call this function a second time within the same transaction, the counter does not increment. It stays the same as the first pass. Is there any way to access the "current" value of GL_ID without committing the transaction?
Thanks!
JD