locked
Me.Form.Requery starts an endless loop RRS feed

  • Question

  • Hi

    Having a pushbutton with the simple code:

    Private Sub Kommandoknapp669_Click()
    Me.Form.Requery
    End Sub

    It starts and endless loop with a blinkning screen.
    Blinking stops when I shift to another app, like Word or whatever.

    Windows 10 64bit, Access 2016 32 bit.

    Why? The code has previously worked without any problems.


    Best // Peter Forss Stockholm GMT +1.00

    Wednesday, April 26, 2017 7:01 AM

Answers

  • Hi Forss,

    Do you have any code running in your Form's Current event, which may be "refreshing" the data such as changing the form's Record Source, for example?

    Wednesday, April 26, 2017 4:23 PM

All replies

  • Just tested on my Win 10 V_1607 Enterprise with Office 365 (2016)

    Cannot reproduce the issue.

    Have you tried

    1. running a compact and repair?
    2. Creating a new Form?

    to test the results?


    Just takes a click to give thanks for a helpful post or answer.
    Please vote “Helpful” or Mark as “Answer” as appropriate.
    Chris Ward
    Microsoft Community Contributor 2012

    Wednesday, April 26, 2017 3:59 PM
  • Hi Forss,

    Do you have any code running in your Form's Current event, which may be "refreshing" the data such as changing the form's Record Source, for example?

    Wednesday, April 26, 2017 4:23 PM
  • Hi KCDW

    Yes I have tried compact and repair.

    A new form with the code has no problems.

    Will now check DBguys advice


    Best // Peter Forss Stockholm GMT +1.00

    Thursday, April 27, 2017 6:45 AM
  • Hi DB

    You are good! I had code running at the forms OnGotFocus Property. Change that code and now the lines:
    Private Sub Kommandoknapp669_Click()
    Me.Form.Requery
    End Sub

    Is doing its job, without a loop.

    Thank you very much.


    Best // Peter Forss Stockholm GMT +1.00

    Thursday, April 27, 2017 6:50 AM
  • Hi Peter,

    Glad to hear you got it sorted out. Good luck with your project.

    Thursday, April 27, 2017 1:18 PM