How to commit a database update in VBA code

How does one commit a change to the database in Access VBA code?  The problem is, I have the following code:

private Sub button_Click()

  If ([Status] = "PASSED") Then
    [Status] = "IDLE"
  End If
  Shell("my_program.exe", 1)

End Sub

and "my_program.exe" is seeing [status] = "PASSED" instead of "IDLE".

If I watch the Access form, I see [status] change to "IDLE" but the little pencil indicating an uncommitted edit remains until the whole "button_Click" sub finishes.  I need the change to be committed before "my_program.exe" runs.

I suspect there exists some method that will fix my problem along these lines:

  If ([Status] = "PASSED") Then
    [Status] = "IDLE"
    [Status].commit or Me.commit
  End If


OS: MS XP Version 2002, 5.1.2600 Service Pack 2 Build 2600
Access: Access 2003 (11.6566.8122) SP2
Database: Microsoft SQL Server 2005
Who is Participating?

  If ([Status] = "PASSED") Then
    [Status] = "IDLE"
    Me.Refresh  <---- Add this
  End If
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Basically .... you can use

Me.Dirty = False   '** this will save a record (commit)

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.