If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
determine which records are being displayed
Here's the situation:
I have a subform that displays a datasheet view of tbl_table, ordered by lastname. There is enough room in the subform for 10 records to be displayed at any given time, with a scrollbar for moving up and down in the table. When a user highlights a record that he or she wants to delete (which can be anywhere in the listing of 10), and clicks on btn_delete, the record is deleted. However, in order to make the deletion complete (and get rid of the #deleted text), the form has to be requeried. That, unfortunately, resets the form such that the first ten records are displayed instead of whatever the user was looking at when he hit the button. What I want is to remove the record being deleted without going back to the top of the list. It seems to me that, if I could determine which records are being displayed before delete, I could add a go to record command after the requery and return to whatever record was at the top of the group being displayed before the delete button was clicked. I'm sure this must be a pretty simple thing to do, but I'm not able to find out how by looking through other threads.. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/200905/1 |
#2
|
|||
|
|||
determine which records are being displayed
This code will requery then take you back to the record that was current
after the delete: To set a "bookmark" if you will (an actual bookmark isn't accurate if records are d/c'd or added) requery then go back to the same record Where [UniqueField] is a field unique to only one record. Where [UniqueField] is Text Dim UF_Rec as String UF_Rec = Me!UniqueField Me.Requery Me.Recordset.FindFirst "[UniqueField] = '" & UF_Rec & "'" Where [UniqueField]is Numeric Dim UF_Rec as (Fill in number type here) UF_Rec = Me!UniqueField Me.Requery Me.Recordset.FindFirst "[UniqueField] = " & UF_Rec -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/200905/1 |
#3
|
|||
|
|||
determine which records are being displayed
Thanks. I'll try it
Linq Adams wrote: This code will requery then take you back to the record that was current after the delete: To set a "bookmark" if you will (an actual bookmark isn't accurate if records are d/c'd or added) requery then go back to the same record Where [UniqueField] is a field unique to only one record. Where [UniqueField] is Text Dim UF_Rec as String UF_Rec = Me!UniqueField Me.Requery Me.Recordset.FindFirst "[UniqueField] = '" & UF_Rec & "'" Where [UniqueField]is Numeric Dim UF_Rec as (Fill in number type here) UF_Rec = Me!UniqueField Me.Requery Me.Recordset.FindFirst "[UniqueField] = " & UF_Rec -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/200905/1 |
#4
|
|||
|
|||
determine which records are being displayed
Thanks. I'll try it
Linq Adams wrote: This code will requery then take you back to the record that was current after the delete: To set a "bookmark" if you will (an actual bookmark isn't accurate if records are d/c'd or added) requery then go back to the same record Where [UniqueField] is a field unique to only one record. Where [UniqueField] is Text Dim UF_Rec as String UF_Rec = Me!UniqueField Me.Requery Me.Recordset.FindFirst "[UniqueField] = '" & UF_Rec & "'" Where [UniqueField]is Numeric Dim UF_Rec as (Fill in number type here) UF_Rec = Me!UniqueField Me.Requery Me.Recordset.FindFirst "[UniqueField] = " & UF_Rec -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/200905/1 |
Thread Tools | |
Display Modes | |
|
|