Results 1 to 10 of 10
  1. #1
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265

    Refreshing the form vs. requerying

    Requerying will reload the recordset. So that would show new records, and deleted records would not be shown anymore right? But refresh does not show new records right?



    I have form called Parent bound to a table called tblParent. I have the table and the form open. I added a new name/record to the form. I advanced to the next record, then went back to see if my new record showed up. And it did show up.

    Was this an example of requerying or refreshing the record since the new record showed up? Why?

    After this, I checked the table and didn't see the new record in the table. Since the new record wasn't in the table, I didn't think it would still be visible in the form but it was. To see the new record in the table, I had to click the Refresh button.

  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,931
    Never thought much about this. I just accept that form is designed to handle new record creation.

    Did you test adding new record directly in the table then see if it shows up on the form right away? It shouldn't. Access does automatically refresh/requery periodically and the record should eventually show in the form.
    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
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by June7 View Post
    Never thought much about this. I just accept that form is designed to handle new record creation.

    Did you test adding new record directly in the table then see if it shows up on the form right away?
    Yes. I didn't show up in the table right away. However, I am fairly certain that earlier tonight, I made a change to a person's first name and with the table in view, I thought I saw the first name update in the table right after I tabbed out of the field. So I was still on the same record.

    Is this possible or perhaps I'm confusing this with something else I did? I couldn't replicate this, however the MS website says that a control is in fact updated after you tab out of it.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Sort of. Edits done on form will show in table as soon as record is committed. Record is committed when close form, move to another record, or run code.

    Even edits directly in table aren't really committed until move to another record. Do some edits then without leaving record press ESC key. What happens?
    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.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862

    Red face

    Just going from memory here, a loose interpretation could be... a control updates a recordset and a form will update a record. Tab out of a control, and the form's recordset gets updated. Navigate to a new record and the table's record get's saved.

    Access_Novice, what you are doing is the correct thing. You need to test the behavior. Understand what is going on behind the scenes. There will be times these nuances matter. The difficult part is remembering all of the nuances.

    If you tab out of a control, it should be immediately reflected in the table. If you then navigate to a new record, it should be saved. The difference is, as I see it, you can still use the form's before update event before you navigate to another record to revert changes to the recordset.

    With that I will include a link to an article on refresh. Bottom line, test the behavior. Testing your app before it goes live is a big deal and it is good you are asking these questions. I am just too tired right now to research a good descriptive and accurate answer.
    http://msdn.microsoft.com/en-us/libr...ffice.11).aspx

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    I tested edit on form and looked for the edit in open table. It did not show until I moved from the record on the form.
    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.

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Yup, I misspoke or mistyped. I edited my post to show tabbing out of a control will not effect the value within the table.

  8. #8
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by June7 View Post
    Do some edits then without leaving record press ESC key. What happens?
    I did an edit in a firstName field, then tabbed out and didn't leave the record. The value in the underlying table did not update after I tabbed out. It updated after I advanced to the next record, which is consistent with what the MS website said. But I am certain that last night, I tabbed out of a field and saw the underlying table value update, although the evidence indicates the opposite.

    I forgot to ask, when using a form, when would you use refresh? When would you use requery?

  9. #9
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by ItsMe View Post
    Just going from memory here, a loose interpretation could be... a control updates a recordset and a form will update a record. Tab out of a control, and the form's recordset gets updated. Navigate to a new record and the table's record get's saved.

    Access_Novice, what you are doing is the correct thing. You need to test the behavior. Understand what is going on behind the scenes. There will be times these nuances matter. The difficult part is remembering all of the nuances.

    If you tab out of a control, it should be immediately reflected in the table. If you then navigate to a new record, it should be saved. The difference is, as I see it, you can still use the form's before update event before you navigate to another record to revert changes to the recordset.

    With that I will include a link to an article on refresh. Bottom line, test the behavior. Testing your app before it goes live is a big deal and it is good you are asking these questions. I am just too tired right now to research a good descriptive and accurate answer.
    http://msdn.microsoft.com/en-us/libr...ffice.11).aspx
    Thank you. Yes, I ask these questions about nuances because I know that in programming the little things really do matter. I appreciate your feedback as well as June7. Thank you both.

  10. #10
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by Access_Novice View Post

    ...I advanced to the next record, then went back to see if my new record showed up. And it did show up...

    ...Was this an example of requerying or refreshing the record since the new record showed up...
    Neither! When you add a New Record, and the Record is saved, such as by moving to another Record, that New Record is there, on your copy of the Form!

    Is is not, however, 'there,' on the same Form that is currently opened by another user! In a multi-user environment, Refreshing their copy of the Form won't make it display, either. It will only display for other users by their Forms being Requeried.

    The Refresh Method is really intended to be used, in multi-user environments, to show UserA any edits made to existing Records by other users. And by 'existing Records, I mean Records that existed when UserA opened his copy of the Form.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Requerying Combo Box
    By djclntn in forum Forms
    Replies: 6
    Last Post: 12-07-2012, 06:19 PM
  2. Replies: 6
    Last Post: 10-15-2012, 01:49 PM
  3. Replies: 0
    Last Post: 11-23-2011, 04:06 PM
  4. Refreshing subform when form refreshed
    By Remster in forum Forms
    Replies: 27
    Last Post: 10-15-2010, 09:39 AM
  5. refreshing form after running query
    By ninachopper in forum Queries
    Replies: 1
    Last Post: 07-12-2010, 04:30 AM

Tags for this Thread

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