L
laura
I need my new records, once entered, to slot into their alphabetical
position in the form, not at the END of the form/table. If I enter a record
and then "Me.Requery", the record pointer goes to the first record, not the
record I just entered. I've been struggling with me.recrodsetclone.bookmark,
but results are inconsistent - it works if I click my save button, but NOT
if I click on the pencil icon on the top right of the form.
TABLE with 3 fields
RecNo (autonumber)
fname (text)
sname (text)
ENTRY FORM form sorted in order of Surname
RecNo (visible but not enabled)
Firt Name:
Surname:
BUTTON which I created which just saves the record:-
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
In the AfterUpdate() procedure:- (which happens whether I click on my button
or on the pencil icon):-
Dim rst As DAO.Recordset
Dim iRec As Integer
iRec = Me.RecID ' it picks up the right RecNo whether I click on the
buton or pencil icon
Set rst = Me.RecordsetClone
Me.Requery ' to put the records into the right alphabetical order
rst.FindFirst "RecID = " & iRec ' to find my most recently entered
record (nomatch is false, so it DOES find the record)
Me.Bookmark = rst.Bookmark ' I need the record to be slotted in
alphabetically and showing.
rst.Close
As I said, this works a treat when I click the button, but NOT when I click
the pencil icon... why??? arghhh.
LauraTD
position in the form, not at the END of the form/table. If I enter a record
and then "Me.Requery", the record pointer goes to the first record, not the
record I just entered. I've been struggling with me.recrodsetclone.bookmark,
but results are inconsistent - it works if I click my save button, but NOT
if I click on the pencil icon on the top right of the form.
TABLE with 3 fields
RecNo (autonumber)
fname (text)
sname (text)
ENTRY FORM form sorted in order of Surname
RecNo (visible but not enabled)
Firt Name:
Surname:
BUTTON which I created which just saves the record:-
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
In the AfterUpdate() procedure:- (which happens whether I click on my button
or on the pencil icon):-
Dim rst As DAO.Recordset
Dim iRec As Integer
iRec = Me.RecID ' it picks up the right RecNo whether I click on the
buton or pencil icon
Set rst = Me.RecordsetClone
Me.Requery ' to put the records into the right alphabetical order
rst.FindFirst "RecID = " & iRec ' to find my most recently entered
record (nomatch is false, so it DOES find the record)
Me.Bookmark = rst.Bookmark ' I need the record to be slotted in
alphabetically and showing.
rst.Close
As I said, this works a treat when I click the button, but NOT when I click
the pencil icon... why??? arghhh.
LauraTD