1

I'm using an MS Access 2010 databse (.accdb) to connect to a database in SQL Server 2016.

I have a form, which uses a linked table to a SQL Server view as it's record source, which enables users to browse a set of records. The form has a button which opens as separate form, in dialog mode, to enable a user to edit a selected record from the browse form. Here's the code of the button;

Private Sub btnEdit_Click()
Dim RecordNumber As Integer

On Error GoTo btnEdit_Click_Err

'open the data entry form in edit mode, showing the currently selected record from the browse form
DoCmd.OpenForm "Application Edit - Template", acNormal, "", "[DB_Key]=" & txtDBKey, acEdit, acDialog
Me.Refresh

btnEdit_Click_Exit:
Exit Sub

btnEdit_Click_Err:
MsgBox Error$
Resume btnEdit_Click_Exit

End Sub

The Me.Refresh method call is not refreshing the form with the changes made on the edit form.

I know that if I use Me.Requery I can force a refresh of the data but unfortunately this also navigates focus to the first record in the data set. I know that I can save the record number to a variable and then use DoCmd.GoToRecord to navigate back. I just would rather MS Access work the way it's supposed to.

Does anyone know why Me.Refresh doesn't work?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.