Results 1 to 5 of 5
  1. #1
    bcarter17 is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jun 2021
    Location
    Richmond MO
    Posts
    35

    Refreshing a field on a form


    I know, for sure, there has to be an easy answer to this one, but for the sake of me I can't get my efforts to work. We have a form that we create load tickets on for outbound drivers. Ownership is asking if we could put a counter on the form showing how many loads we have shipped for the current date. I can query and count the ticket numbers for the current date and get the number. I can then show that number on a hidden form whenever the ticket form is open, and I can then create a text box to show the number from the query/hidden form on the the ticket form. However, I cannot get it to refresh. I have tried various combinations of requery, refresh, etc. but I have not gotten anything to work. I was trying to run code off of a timer event every 10 seconds, but to no avail.

    Can someone light the path for me, I know I have done this in the past but my mind if a blank on how to fix this.....

  2. #2
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Have you tried using a dCount as the control source for the text box (say txtTodaysLoads) on the form and in the Timer event of the form use Me.txtTodaysLoads.Requery?

    Code:
    txtTodaysLoads.ControlSource=dCount("*","tblLoads","[LoadDate]=#" & Date() & "#")
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,653
    I have tried various combinations of requery, refresh, etc.
    there is also recalc

    https://docs.microsoft.com/en-us/off...ss.form.recalc
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,798
    Why do this on a timer? It can be a resource hog and continues to fire when the form is open and everyone is at lunch (if you get my point). Refresh the control on the form AfterInsert event and if you will restrict the counter update to newly added records. If the form is unbound, use whatever event saves the record. If the info (count) isn't current then it's not that vital - but that might be OK for the process. Besides, it's far less code than writing a timer event for this, not to mention that when Boss says "I want it every 5 minutes" you're not going into form design or table data and changing the timer interval.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    Not sure about the OP's specific setup but in a multi-user environment my counter being refreshed just on AfterInsert would be off if a my coworkers just added a bunch of loads while I was having my break. In my opinion in this case to have a more accurate visual count using the timer event is more appropriate, and doing a simple dCount shouldn't be that taxing on the modern hardware.

    Just my 2 cents....
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Form seems to keep refreshing.
    By kathiepreston in forum Forms
    Replies: 24
    Last Post: 09-15-2021, 07:21 AM
  2. continuos form not more refreshing
    By diegomarino in forum Access
    Replies: 7
    Last Post: 05-05-2020, 09:52 AM
  3. Replies: 5
    Last Post: 02-10-2015, 04:37 PM
  4. Refreshing the form vs. requerying
    By Access_Novice in forum Forms
    Replies: 9
    Last Post: 01-01-2014, 07:24 PM
  5. Replies: 0
    Last Post: 11-23-2011, 04:06 PM

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