Hi, all--
I have a standard command button on a form to delete the current record. After this is done, I want to go to the previous record (assuming we're not at the first record).
I have tried various docmd.gotorecord statements in the VBA but have various problems.
When using acPrevious, I get a "Can't go to specific record", even if the deleted record was the last record.
When I use the acLast, the form goes to the first record. In fact, I either get the "Can't go to..." or the form goes to the first record no matter which "ac" I use.
My code is as follows (and it's very basic):
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Me.Requery
DoCmd.GoToRecord , , acPrevious (or acLast)
Any suggestions?
Thanks.
I have a standard command button on a form to delete the current record. After this is done, I want to go to the previous record (assuming we're not at the first record).
I have tried various docmd.gotorecord statements in the VBA but have various problems.
When using acPrevious, I get a "Can't go to specific record", even if the deleted record was the last record.
When I use the acLast, the form goes to the first record. In fact, I either get the "Can't go to..." or the form goes to the first record no matter which "ac" I use.
My code is as follows (and it's very basic):
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Me.Requery
DoCmd.GoToRecord , , acPrevious (or acLast)
Any suggestions?
Thanks.