0
我需要打開一個表(不匹配);創建一個新字段(ID);使用現有字段創建一個新的唯一字符串(赫茲);然後,最後,將這個新字符串插回到表格的新字段中。我被卡住了,因爲我是新人。任何微調前鋒將不勝感激。在表中插入計算字段作爲一個字符串VBA - MS Access
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim Hertz As String
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set tdf = db.TableDefs("Unmatched")
Set fld = tdf.CreateField("ID")
Set rst = db.OpenRecordset("Unmatched", dbOpenTable)
Do Until rst.EOF
hertz = rst![Accounting Document Item] & Mid(rst![JE Line Description], 20, 2) & Round(Abs(rst![Transaction Amount]), 0)
Debug.Print hertz 'immediate window check
---> DoCmd.RunSQL "?!?!?"
rst.MoveNext
Loop
Application.RefreshDatabaseWindow
Set fld = Nothing
Set tdf = Nothing
Set db = Nothing
End Sub
rst。編輯,rst.Update(請見在線幫助) – Andre
@Andre,謝謝。你是對的。 –