locked
REFRESH ON CLICK EVENT RRS feed

  • Question

  • I am using a Sales Order Form which I use as the source for several Reports.  At times I need to update info and then directly run a report, however I've got my 'sort on load' setting for [SalesID] Desc., because I like the form always to be on the latest record on Open, using the default refresh would bring the user back to the newest record.  What I would like to do is create a Refresh Button on Click Event that will not re-sort my records, but rather remain on the current record, so when it is refreshed the user does not have to go back and find the record they were working on.  Any ideas?

    Thanks,

    js

    Friday, December 20, 2013 5:09 PM

Answers

  • Set the Me.CurrentRecord first.

    CurrentRec = Me.CurrentRecord

    Me.Refresh or whatever

    DoCmd.GoToRecord acDataForm, "NAME OF YOUR FORM", acGoTo, CurrentRec

    • Proposed as answer by Imran J Khan Friday, December 20, 2013 9:08 PM
    • Marked as answer by Marvin_Guo Monday, December 30, 2013 1:38 AM
    Friday, December 20, 2013 6:55 PM

All replies

  • Set the Me.CurrentRecord first.

    CurrentRec = Me.CurrentRecord

    Me.Refresh or whatever

    DoCmd.GoToRecord acDataForm, "NAME OF YOUR FORM", acGoTo, CurrentRec

    • Proposed as answer by Imran J Khan Friday, December 20, 2013 9:08 PM
    • Marked as answer by Marvin_Guo Monday, December 30, 2013 1:38 AM
    Friday, December 20, 2013 6:55 PM
  •   What I would like to do is create a Refresh Button on Click Event that will not re-sort my records, but rather remain on the current record, so when it is refreshed the user does not have to go back and find the record they were working on.  Any ideas?

    If pressing the Refresh Button is just a Refresh, and not a Requery, then you can include in the Click event:

          Me.PreviousControl.SetFocus

    If the focus was on a control of the current record just before the click, then the focus will return to that control.

    Imb.

    Friday, December 20, 2013 8:29 PM