|
Private Sub 命令35_Click()
Dim a
Dim b
a = Me.开始号码
b = Me.结束号码 Dim m As Object
Set m = CurrentDb.OpenRecordset("test") Do While a <= b If DCount("发票编号", "test", "发票编号= ('" & a & "')") > 0 Then a = a + 1 Else m.AddNew
m("发票编号") = a
m("开票人姓名") = Me.开票人姓名
m.Update a = a + 1
End If
Loop m.CloseEnd Sub运行后提示If DCount("发票编号", "test", "发票编号= ('" & a & "')") > 0 Then 出错请问' "& a &" '是什么意思? 我的“发票编号”字段是数值类型我将此句改成If DCount("发票编号", "test", "发票编号= val('" & a & "')") > 0 Then 为何陷入死循环,不停的添加纪录,a已经大于 b还不停。 |
|