[Access97][DAO] Booklmark problem

W

Willy

My form is bounded to a query

Even if on the form i'm positioned on the last recod
the bookmark always move me to the first record

=========================================

Private Sub edtCodice_BeforeUpdate(Cancel As Integer)
Dim fd As DAO.Field
Dim rst As DAO.Recordset
Dim bkmrkRecord As String

'
' when the event is fired on the form
' i'm positioned on the last record
'
bkmrkRecord = Me.RecordsetClone.Bookmark
Set rst = Me.RecordsetClone
rst.Bookmark = bkmrkRecord

Set fd = rst.Fields![Codice]

rst.Edit
'
' always the first record is edited
' and updated
'
fd.Value = LPad(Me!edtCodice.Text, "0", fd.Size)
rst.Update
End Sub

============================================

what i'm missing ?
Any help would be appreciate

TIA,
Stefano Campri
 
W

Willy

My form is bounded to a query
Even if on the form i'm positioned on the last recod
the bookmark always move me to the first record

problem solved
=========================================

Private Sub edtCodice_BeforeUpdate(Cancel As Integer)
Dim fd As DAO.Field
Dim rst As DAO.Recordset
Dim bkmrkRecord As String

'
' when the event is fired on the form
' i'm positioned on the last record
'

this was wrong :
bkmrkRecord = Me.RecordsetClone.Bookmark



this is seems to be right :
bkmrkRecord = Me.Bookmark

Set rst = Me.RecordsetClone
rst.Bookmark = bkmrkRecord

Set fd = rst.Fields![Codice]

rst.Edit
'
' always the first record is edited
' and updated
'
fd.Value = LPad(Me!edtCodice.Text, "0", fd.Size)
rst.Update
End Sub

============================================


Greetings,
Stefano Campri
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top