Results 1 to 9 of 9
  1. #1
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727

    Auto sum formula not working

    I have an auto sum vba code that adds up a few fields based on what the user enters. The auto sum works on the on lost focus event. So as the user scrolls through records by clicking on some buttons I made, I put vba behind these buttons to set focus on the field that auto sums the set focus to another field to trigger the on lost focus event. However when the user clicks the find record button I created and gets the find record dialog box then does a search to find the record they want, I have no way of refreshing the auto sum or to trigger the auto sum to take place. Any ideas? I tried the on change event of the field and also tried using this:



    if me.txtdateissued <> me.txtdateissued.oldvalue then
    (calculation code)

    But it did not work.

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Try using the OnLostFocusEvent and Refresh your data.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    You might try the current event, which fires when the user changes records via any means.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    How do you refresh?

  5. #5
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Yeah I tried the on current too but could not get it to work. Is there an event or something where I can have an action take place after the user closes the find dialog box? That would be the perfect place to have a refresh action of some kind.

  6. #6
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    You can try this.
    Forms!YourFormNameHere.Requery

  7. #7
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    I'll try it but I did find a solution for now. I just coded behind the on got focus of each field so when the user does a search the focus will go to a field on whatever the user is trying to find, creating the auto sum to refresh the fields. Thanks everyone for the help.

  8. #8
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Glad you got it sorted out. Good Luck With Your Project.

  9. #9
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Thank you very much.

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

Similar Threads

  1. Auto populate not working in form
    By rosefield in forum Forms
    Replies: 12
    Last Post: 04-29-2014, 03:51 PM
  2. Replies: 2
    Last Post: 04-15-2014, 10:03 PM
  3. BMI calculation formula not working...
    By coolpal9 in forum Forms
    Replies: 2
    Last Post: 03-27-2012, 12:06 PM
  4. Auto email not working
    By edzigns in forum Programming
    Replies: 1
    Last Post: 04-29-2011, 12:41 PM
  5. Replies: 1
    Last Post: 03-31-2011, 02:51 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