Results 1 to 8 of 8
  1. #1
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150

    Updating textbox value in form footer

    OK, I'm stumped. I basically have a textbox, call it txtNewValue in the form footer that I would like updating after the user updates a bound textbox in the detail section and after the user clicks a save button . I have straightforward math for txtNewValue calculation, but now since it's not updating correctly, I've assigned values to TempVar variable and made txtNewValue bound to the TempVar variable. I noticed that in real time, the txtNewValue is not updating when the user clicks the save button. However, when I step through the codes, upon the me.form.requery, the value is updated. If I remove the break point and run it, txtNewValue does not get updated. Even if close down the form and relaunch it, txtNewValue is not updated. What's going on?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    What is this value in txtNewValue? Is it a Sum of records in the subform? Should not be saving this calculated aggregate to table.

    What is purpose of showing this aggregate on form? This is normally best done in report.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150
    Quote Originally Posted by June7 View Post
    What is this value in txtNewValue? Is it a Sum of records in the subform? Should not be saving this calculated aggregate to table.

    What is purpose of showing this aggregate on form? This is normally best done in report.
    No, txtNewValue is actually the difference between a variable and the sum of the detail. I just don't understand that when I step through the VBA code in the various routines involved, I can see the textbox value change, but when I remove the breakpoint, nothing happens.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,973
    Try adding the line DoEvents in your code to allow processing to complete.
    Do you need to requery the control as well?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150
    Quote Originally Posted by ridders52 View Post
    Try adding the line DoEvents in your code to allow processing to complete.
    Do you need to requery the control as well?
    What do you mean by DoEvents, like DoCmd.RunCommand acCmdSaveRecord ?
    And yes, I have requery the form and the textbox as well, but still no luck.

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,973
    Just write DoEvents on it's own line as one word with no space.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  7. #7
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150
    Nice, DoEvents seems to do the trick. I've never used this function before. Not sure what this is, but I'm going to read up on it. Thanks, Colin.

  8. #8
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,973
    As I said before, it allows processing to complete before going on to the next line of code
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 2
    Last Post: 11-23-2015, 06:59 PM
  2. Updating combobox based on value in a textbox...
    By Voodeux2014 in forum Programming
    Replies: 12
    Last Post: 05-28-2015, 06:43 PM
  3. Updating textbox - combobox per record
    By vincentsp in forum Forms
    Replies: 4
    Last Post: 02-18-2015, 08:09 AM
  4. Replies: 1
    Last Post: 07-21-2014, 04:06 PM
  5. Replies: 1
    Last Post: 12-17-2010, 04:25 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