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

Refreshing Main Form

P: 10
I have a form (stockcard) and I want to refresh it everytime I input addtional item from another form (stock_list). I was able to refresh the said form (stockcard) using requery on click event of stock_list form. however, the record go to the first record of stockcard form everytime i refresh this instead of the current record (the item that i have chosen from the stock_list form). what codes do i need to use in order for the stockcard form to go to the current record and not to the first record?

your help is greatly appreciated!
Dec 12 '06 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 3,532
Here's an example:

Expand|Select|Wrap|Line Numbers
  1. Private Sub RequeryAndReturnToRecord_Click()
  2. Dim ClientName As String
  4.   ClientName = Me.CustomerName.Value  'Assigns ID to variable
  5.   Me.Requery  'Requeries form
  7.   'Returns to record that was current when Requery was done
  8.   Set rs = Me.Recordset.Clone
  9.         rs.FindFirst "[CustomerName] = '" & ClientName & "'"
  10.         Me.Bookmark = rs.Bookmark
  12. End Sub
CustomerName is a unique identifier for the current record. It's assigned to the variable ClientName, the form is requeried, then it's used to return to the record that was current before the requery.
Dec 12 '06 #2

Post your reply

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