效率上要提高,比如Save这个Event,你这样写:
Dim currTable As String
currTable = “barrons”
Dim currKey As String
currKey = ctrlList.Value
Dim myEntry As Recordset
Set myEntry = CurrentDb.OpenRecordset(currTable)
Do Until myEntry.EOF = True
If myEntry.Fields(0) = currKey Then
myEntry.Edit
myEntry.Fields(1) = PlainText(ctrlEditor.Value)
myEntry.Update
Exit Do
End If
myEntry.MoveNext
Loop
其实取得RecordSet时,用Query把条件带上,一下子就搞定了。
(或者直接用Update SQL,不用RecordSet)