WojtekKowalski
New member
- Local time
- Today, 13:22
Hi
I have code to prevent "jumping view" after requiring form, so that whenever I requery data, cursor, view and scrollbar stay in the same place. It works perfectly fine.
Form:
Continuous form with header.
Code:
I had to change my application, so now it is Single Form with header and within this form I have Subform - Datasheet Form.
I have placed above mentioned code in the subform. The problem is I need to adjust somehow these numbers "450" and "510" otherwise view and scrollbar will be jumping after requery , but to be honest I don't know what actually these numbers are for. I'm guessing they somehow describe Height of workspace. Can someone help me adjust them to my current structure?
I have code to prevent "jumping view" after requiring form, so that whenever I requery data, cursor, view and scrollbar stay in the same place. It works perfectly fine.
Form:
Continuous form with header.
Code:
Code:
Dim lngSelTopCurrentRecord As Long
Dim lngRowsFromTop As Long
Dim lngSelTopUppermostRecord As Long
Me.RobotName.SetFocus
lngSelTopCurrentRecord = Me.Form.SelTop
Me.Form.Painting = 0
lngRowsFromTop = (Me.Form.CurrentSectionTop - 450) \ 510
Me.Form.Recordset.Move -1 * (lngRowsFromTop - 1)
lngSelTopUppermostRecord = Me.Form.SelTop
Me.Form.Requery
Me.Form.Recordset.MoveLast
Me.Form.SelTop = lngSelTopUppermostRecord
Me.Form.SelTop = lngSelTopCurrentRecord
Me.Form.Painting = -1
I had to change my application, so now it is Single Form with header and within this form I have Subform - Datasheet Form.
I have placed above mentioned code in the subform. The problem is I need to adjust somehow these numbers "450" and "510" otherwise view and scrollbar will be jumping after requery , but to be honest I don't know what actually these numbers are for. I'm guessing they somehow describe Height of workspace. Can someone help me adjust them to my current structure?