By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,145 Members | 1,472 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,145 IT Pros & Developers. It's quick & easy.

Refreshing a Form Without Going to Record One

P: 17
I have a form with a subform, and a child linked form.

The main form is a data entry point for different business tracking. The child form that is opened from that is used to enter product information, that when closed, refreshes the main form, so that the product information appears in the subform area. (Basically populating a list)

Right now on the "close/update" button of the child form, I have code that prompts the main form to refresh. (Forms![frmName].Requery)...the problem is, I don't know how to get it to refresh the data, but to stay on the selected record. The refresh resets the record to 1, and then I have to scroll back through to my selected record.

Ideas?
Aug 10 '07 #1
Share this Question
Share on Google+
4 Replies


ADezii
Expert 5K+
P: 8,669
I have a form with a subform, and a child linked form.

The main form is a data entry point for different business tracking. The child form that is opened from that is used to enter product information, that when closed, refreshes the main form, so that the product information appears in the subform area. (Basically populating a list)

Right now on the "close/update" button of the child form, I have code that prompts the main form to refresh. (Forms![frmName].Requery)...the problem is, I don't know how to get it to refresh the data, but to stay on the selected record. The refresh resets the record to 1, and then I have to scroll back through to my selected record.

Ideas?
Expand|Select|Wrap|Line Numbers
  1. Dim varBookmark As Variant   'will hold Current Bookmark
  2.  
  3. 'Store the original Bookmark in a Variant
  4. varBookmark = Me.Bookmark
  5.  
  6. 'Requery the Form
  7. Me.Requery
  8.  
  9. 'Restore the original Bookmark
  10. Me.Bookmark = varBookmark
  11.  
Aug 10 '07 #2

P: 17
Seems to solve my problem. Thank you.
Aug 10 '07 #3

ADezii
Expert 5K+
P: 8,669
Seems to solve my problem. Thank you.
You are very welcome.
Aug 10 '07 #4

P: 17
Frustrating. This was working a couple of weeks back, but when I revisit the database now, it's saying that it's "not a valid bookmark".

Expand|Select|Wrap|Line Numbers
  1. 'Close the form I just entered the data into
  2. DoCmd.Close acForm, "frmMPR_Price_Subform"
  3.  
  4. Dim varBookmark As Variant
  5.  
  6. 'Store the original Bookmark of the sheet I want to requery to show the updated form
  7. varBookmark = Forms!frmMPR.Bookmark
  8.  
  9. 'Requery the Form
  10. Forms!frmMPR.Requery
  11.  
  12. 'Restore the original Bookmark
  13. Forms!frmMPR.Bookmark = varBookmark
  14.  
Then it errors out. Form resets to record 1.

Any help?
Aug 21 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.