Link to home
Start Free TrialLog in
Avatar of hcstttam
hcstttam

asked on

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


Thanks,
Matthew

Details:
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
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial