Changes in MS Access Form Not Automatically Updating Linked Tables in SQL Server

85 views Asked by At

I am currently working on a Microsoft Access database where I have linked tables connected to a SQL Server backend. The setup involves a form in Access through which users make changes to the data. However, I've encountered an issue where changes made in the Access form only reflect the changes to the local tables of MS Access .But what I want is that it should also reflect changes to the linked tables of SQL server added through ODBC.

Details

  • I have ensured that the form is bound to the correct table.
  • The controls on the form are properly bound to corresponding fields.
  • I am using VBA with the AfterUpdate event to trigger saving changes.
  • Even after making changes and saving records through the form, the linked tables do not update unless I manually refresh them.

Code Example Here is an example of the VBA code used in the AfterUpdate event:

Private Sub frmJobs_AfterUpdate()
    ' Save the current record
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

    ' Refresh the linked table
    CurrentDb.TableDefs("dbo_tblJobs").RefreshLink
End Sub

What could be causing this issue, and how can I ensure that changes made in the Access form are automatically reflected in the linked tables on SQL Server?

Additional Details

  • MS Access version: 2013
  • Linked table connection details: I used ODBC(x64 bit) to create connection between SQL Server and MS Access

Any help would be appreciated.

1

There are 1 answers

5
Gustav On

Refresh the form:

Private Sub frmJobs_AfterUpdate()

    ' Save the current record.
    Me.Dirty = False

    ' Refresh the form. Should not be needed.
    Me.Refresh

End Sub