我需要在VB中更新简单的查询,我可以更新表中最后一条记录中的某些字段。在Access 2010中更新记录集
我有这样的形式与一组组合框的,当我按下Edit
按钮,我应该能够从组合框选择不同的值,当我按下Save
,应该更新的最后一条记录我的桌子上有我的组合框中的最新选择。请指教。
我有下面的代码,但它只是垃圾,它不会编辑我的表中的任何东西。
Private Sub Command51_Click()
Dim RS As DAO.Recordset
Dim RecID As Integer
Set RS = CurrentDb.OpenRecordset("Data", dbOpenDynaset)
RecID = DLast("[ID]")
RS.MoveFirst
Do Until RS.EOF
If RS("ID") = RecID Then
RS.Edit
RS("WLAN") = Me.Text34
RS("Controller Version") = Me.Text38
RS("AP Model") = Me.Text36
RS("Security") = Me.Text39
RS("Wired Network") = Me.Text37
RS("Installation Type") = Me.Text40
RS("Quoted Device") = Me.Text41
RS.Update
RS.Close
End With
MsgBox "Device info were edited and stored.", vbExclamation
末次
而这里的表结构[编辑]
'我有这种形式'< - 哪种形式?请包含截图? StackOverflow允许从剪贴板复制/粘贴。 – Neolisk
对不起。请查看下面的图片http://imageshack.com/a/img33/192/qjk6.jpg –
好。还请包括您的代码和表格结构。 – Neolisk