我有这个代码可以访问:
Option Compare Database
Public Sub batchAdd(records As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim i As Integer
Set db = CurrentDb
Set rs = db.OpenRecordset("tblMeters")
i = 1
Do While i <= records
rs.AddNew
rs!value1 = Me.value1
rs!Ticket = Me.Ticket
rs!value2 = Me.value2
rs!value3 = Me.value3
rs!value4 = Me.value4
rs!value5 = Me.value5
rs!value6 = Me.value6
rs!value7 = Me.value7
rs.Update
i = i + 1
Loop
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
Private Sub cmdAddRecords_Click()
batchAdd Me.txtRecords
Me.tblMeters_sub.Requery
End Sub
我的问题是如何为每个插入的记录增加+1的票证值。
示例:如果我插入值为1到10次的票证,第一次将是1,第二次是2,然后是3 ....如何更改票证值的此代码?
答案 0 :(得分:0)
将此行调整为:
rs!Ticket = i