Microsoft Access Turn off Filter and stay on record
Currently, I have a behavior implemented which allows my MS Acess DB to go to a specific record in another subform. However, t开发者_开发问答his leaves the filter on, and when I turn off the filter the subform returns back to the first entry in the overall set. Is there a way I can navigate to this record, then turn off the filter but stay at the record I found?
I've been trying to pop VBA code into on enter or on click but I can't seem to figure out what to do.
Use the primary key of your subform to navigate back to the record. Put a command button on your form and in the event procedure of the button do something like this:
Dim ID as Variant
With [SubForm].Form
ID=!PrimaryKey.Value
.FilterOn = False
.Recordset.FindFirst "[ID]=" & ID
End With
That should get you in the ball park.
精彩评论