Results 1 to 3 of 3
  1. #1
    john134 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2014
    Posts
    42

    Refresh a table using code

    I am updating a table using a form/subform to input a new record. After entering the new data in the fields of the subform, I can then open the table, click Refresh All on the toolbar and the new record has been added to the table. However, I want to program this and I have tried almost every permutation of Refresh and Requery code I can think of but I cannot get it to work. I would appreciate any suggestions as to what code to write and what Event to attach it to.



    John134

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Data entered/edited on bound form is committed to table when the form closes, move to another record, or run code to save.

    DoCmd.RunCommand acCmdSaveRecord
    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
    john134 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2014
    Posts
    42
    Thank you for resolving my issue. I was led astray by the toolbar Refresh command, which appeared to me that the record had not been saved, whereas it already had been.
    One tip: don't leave the table open as you develop the form. It won't display the new record until the table is closed and then reopened. Or, alternatively, if you leave the table open, it is necessary to manually Refresh it to see the new records.
    John134

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

Similar Threads

  1. how to give a code for save and refresh
    By venu_resoju in forum Forms
    Replies: 7
    Last Post: 04-03-2013, 12:29 PM
  2. Refresh Table Links Code
    By Lowell in forum Programming
    Replies: 5
    Last Post: 03-05-2013, 11:16 PM
  3. auto refresh the table content
    By mohammad8065 in forum Access
    Replies: 1
    Last Post: 02-27-2012, 01:54 PM
  4. Form Code refresh on open
    By mseeker22 in forum Forms
    Replies: 2
    Last Post: 07-08-2011, 12:35 AM
  5. Replies: 3
    Last Post: 10-04-2010, 01:31 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