Hi Lisa,
Could you please send me (changliw_at_microsoft_dot_com) a piece of your
test Access database so that I can easily reproduce your issue and perform
effective research?
In this response, I would like to give you some general suggestions on
updating a record in access. Hope they are helpful.
1. Use RunSQL method
For example:
=============================
Dim strSQL As String
strSQL = "UPDATE MyTable SET MyField = 1234 WHERE IDField = 1"
' Use RunSQL to execute the statement.
' This will result in a user confirmation dialog.
DoCmd.RunSQL strSQL
' Use DAO to execute the statement -- no dialog.
CurrentDb.Execute strSQL, dbFailOnError
===============================
2. Use Recordset object
Working with recordsets is more object-oriented, though may be less
efficient than just executing SQL statements.
For example:
=============================================
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
' Read a value from a specific record, ID known in advance:
Set rst = db.OpenRecordset( "SELECT MyField FROM MyTable WHERE IDField =
1")
' Open a recordset and loop through records, editing some of them:
Set rst = db.OpenRecordset("MyTable")
With rst
' Let's find a particular record.
.FindFirst "IDField = 1"
!MyField = 1234
.Update
' Always close the recordsets you open.
.Close
End With
============================================
Best regards,
Charles Wang
Microsoft Online Community Support
=========================================================
Delighting our customers is our #1 priority. We welcome your
comments and suggestions about how we can improve the
support we provide to you. Please feel free to let my manager
know what you think of the level of service provided. You can
send feedback directly to my manager at: (e-mail address removed).
=========================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
=========================================================