467,864 Members | 1,771 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,864 developers. It's quick & easy.

Refreshing a Form Without Going to Record One

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
  • viewed: 1958
Share:
4 Replies
ADezii
Expert 8TB
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
Seems to solve my problem. Thank you.
Aug 10 '07 #3
ADezii
Expert 8TB
Seems to solve my problem. Thank you.
You are very welcome.
Aug 10 '07 #4
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.

Similar topics

10 posts views Thread by Philo Del Middleston | last post: by
8 posts views Thread by Neil | last post: by
9 posts views Thread by William Wisnieski | last post: by
2 posts views Thread by dmartin_1 | last post: by
1 post views Thread by Iain | last post: by
5 posts views Thread by chimambo | last post: by
4 posts views Thread by magmike | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.