2
Public Function EditUpdate()
Dim rstEditAddress As DAO.Recordset
Dim Svalue, EditedAddressLine1 As Variant
Svalue = Me.lstBoxCompanyName.Value
EditAddressValue = "SELECT * FROM Companies WHERE CompanyID = " & Svalue
Set rstEditAddress = CurrentDb.OpenRecordset(EditAddressValue)
EditedAddressLine1 = Me.txtbxAddressLine1.Value
With rstEditAddress
.Edit
.Fields("AddressLine1") = EditedAddressLine1
.Fields("AddressLine2") = NewAddressLine2
.Fields("AddressLine3") = NewAddressLine3
.Fields("Town") = NewTown
.Update
End With
End Function
我有一個方便地命名爲txtbxAddressLine1
的文本框。使用Access中的On Change
事件,事件調用此函數,並應執行使用「編輯」數據更新表中記錄的過程。但EditedAddressLine1
中的值似乎永遠不會改變!它始終具有原來在表中的價值。在On Change事件處理程序中檢索控件的新內容
有關爲何發生這種情況的任何建議?
了'隨着...'塊之前做了'Debug.Print EditedAddressLine1'。查看「EditedAddressLine1」中存儲的值是否是您期望被覆蓋的實際值 – 2013-12-13 10:32:51