[SOLVED] Reload form but stay on current record

Creating and using forms
Post Reply
MHCom
Posts: 16
Joined: Fri Nov 08, 2019 4:55 pm

[SOLVED] Reload form but stay on current record

Post by MHCom »

Hi,

I have a simple macro assigned to a push button to change allowupdates to "true", but for it to work it needs to reload the form. When the form is reloaded it goes back to the first record but I need it to stay on the current record. Is there a way of doing this?
Last edited by robleyd on Wed Jan 29, 2020 1:21 pm, edited 2 times in total.
Reason: Add green tick
OpenOffice 4.1.5 on Windows 7 Professional
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: Reload form but stay on current record

Post by F3K Total »

Try this:

Code: Select all

Sub Reload_Form_keep_current_Row
    oForm = ThisComponent.DrawPage.Forms.getbyName("MainForm")
    nRow = oForm.Row
    oForm.reload 'reload form
    oForm.Absolute(nRow) 'set the cursor back to previous current row
End Sub
R
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
MHCom
Posts: 16
Joined: Fri Nov 08, 2019 4:55 pm

Re: Reload form but stay on current record

Post by MHCom »

Perfect, thank you!
OpenOffice 4.1.5 on Windows 7 Professional
Post Reply