Refreshing Main Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tonsam
    New Member
    • Oct 2006
    • 10

    #1

    Refreshing Main Form

    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!
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Here's an example:

    Code:
    Private Sub RequeryAndReturnToRecord_Click()
    Dim ClientName As String
    
      ClientName = Me.CustomerName.Value  'Assigns ID to variable
      Me.Requery  'Requeries form
    
      'Returns to record that was current when Requery was done
      Set rs = Me.Recordset.Clone
    		rs.FindFirst "[CustomerName] = '" & ClientName & "'"
    		Me.Bookmark = rs.Bookmark
    
    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.

    Comment

    Working...