D
Dadioles
I need to return to the same record after a Requery and am too much of a
beginner to solve it myself.
I did find this code on the internet but did not have the skill to apply it
properly:
----------
Private Sub NoOfDays_AfterUpdate()
Dim lngKeyVal As Long
'Save the value for the current record
lngKeyVal = Me.txtKeyFieldControl
'Requery the form
Me.Requery
'Move back to the original record
With Me.RecordsetClone
..FindFirst "[KeyField] = " & lngKeyVal
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
------------
The field that identifies the record in my database is called "CompanyPanel"
and is a text key field, not numeric.
The Form is called "1MasterForm" and it contains two SubForms.
I have created a Command Button called "Refresh Display" and the simple code
that I put into it was:
Private Sub RefreshDisplay_Click()
DoCmd.Close
DoCmd.OpenForm "1MasterForm"
End Sub
But obviously although it does what I want by way of cleaning up the screen
I need it to return to the record that was being displayed, not the first
record.
Thank you in advance for any advice.
Best wishes to all from Les
beginner to solve it myself.
I did find this code on the internet but did not have the skill to apply it
properly:
----------
Private Sub NoOfDays_AfterUpdate()
Dim lngKeyVal As Long
'Save the value for the current record
lngKeyVal = Me.txtKeyFieldControl
'Requery the form
Me.Requery
'Move back to the original record
With Me.RecordsetClone
..FindFirst "[KeyField] = " & lngKeyVal
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
------------
The field that identifies the record in my database is called "CompanyPanel"
and is a text key field, not numeric.
The Form is called "1MasterForm" and it contains two SubForms.
I have created a Command Button called "Refresh Display" and the simple code
that I put into it was:
Private Sub RefreshDisplay_Click()
DoCmd.Close
DoCmd.OpenForm "1MasterForm"
End Sub
But obviously although it does what I want by way of cleaning up the screen
I need it to return to the record that was being displayed, not the first
record.
Thank you in advance for any advice.
Best wishes to all from Les