Results 1 to 7 of 7
  1. #1
    www is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    17

    More eficient way to requery?

    Hello,

    I set up a form with multiple text boxes that show the results of a DCount. Each text box pulls info from different tables and queries. I use 2 text boxes as date ranges and want all the aforementioned DCounts to refresh when the date range is changed. My current method works, but I wanted to know if there is a more efficient way to do this. Here is the code I have for "On Click"

    Private Sub txt_str_dte_AfterUpdate()
    Me.enftxt_1.Requery
    Me.enftxt_2.Requery
    Me.enftxt_3.Requery
    Me.enftxt_4.Requery
    Me.enftxt_5.Requery
    Me.enftxt_6.Requery
    Me.enftxt_7.Requery
    Me.enftxt_8.Requery
    Me.enftxt_9.Requery
    Me.enftxt_10.Requery
    Me.enftxt_11.Requery
    Me.enftxt_12.Requery
    Me.enftxt_13.Requery
    Me.enftxt_14.Requery
    Me.enftxt_15.Requery
    Me.enftxt_16.Requery
    Me.enftxt_17.Requery
    Me.enftxt_18.Requery
    Me.enftxt_19.Requery
    Me.enftxt_20.Requery
    Me.enftxt_21.Requery
    Me.enftxt_22.Requery
    Me.enftxt_23.Requery
    Me.enftxt_24.Requery
    Me.enftxt_25.Requery
    Me.enftxt_26.Requery
    Me.enftxt_27.Requery
    Me.enftxt_28.Requery
    Me.enftxt_29.Requery
    Me.enftxt_30.Requery
    Me.enftxt_31.Requery
    Me.enftxt_32.Requery
    Me.enftxt_33.Requery
    Me.enftxt_34.Requery
    Me.enftxt_35.Requery


    End Sub

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    just

    me.requery

    which will requery the entire form

  3. #3
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Use Me.Requery. It should update everything on your form.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  4. #4
    www is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    17
    right, but will it requery the date boxes which are on the same form?

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    yes - but since these are manually completed, they won't change

    tip - enter the code as suggested, comment out your existing code and just try it.

  6. #6
    www is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    17
    Thanks,

    I tried the code but now nothing is updating:

    Private Sub txt_str_dte_AfterUpdate()
    Me.Requery
    End Sub


    Should I use something other than After Update?

  7. #7
    www is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2018
    Posts
    17
    me.recalc worked

    Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. AfterUpdate requery does not requery list box
    By ittechguy in forum Programming
    Replies: 5
    Last Post: 09-05-2017, 08:51 AM
  2. Requery
    By Erictsang in forum Queries
    Replies: 11
    Last Post: 09-04-2017, 03:47 AM
  3. Requery
    By Erictsang in forum Programming
    Replies: 6
    Last Post: 08-27-2017, 10:58 AM
  4. requery
    By texas1014 in forum Queries
    Replies: 7
    Last Post: 06-18-2015, 02:55 PM
  5. Requery
    By Grizz2 in forum Queries
    Replies: 2
    Last Post: 05-31-2011, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums