yaw 发表于:2021-05-12 15:33:17
请老师看看这段代码的错误问题。谢谢
我练习着学习写代码:
我想批量将表“tbl序列数”,增加到表1中,但是报错,请看看图片,不知问题再哪里?谢谢
Private Sub Command0_Click()
Dim rs As adodb.Recordset
Dim rs1 As adodb.Recordset
Dim stemp As String
Dim stemp1 As String
Set rs = New adodb.Recordset
Set rs1 = New adodb.Recordset
strTemp = "Select * From tbl序列数"
rs.Open strTemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
stemp1 = "select * from 表1"
rs1.Open strTemp1, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Dim intCount, intCount1 As Integer
'CurrentDb.Execute "DELETE * FROM 表1"
rs1.AddNew
rs!sn = rs1!sn
rs1.Update
Set rs1 = Nothing
intCount1 = DCount("SN", "表1")
MsgBox "已生成: " & Format(intCount1, "#,###") & " 条 新记录!请查看报表!", vbInformation, "生成序列数"
End Sub
貌似 rs1.Open strTemp1, ... 中的strTemp1未赋值
请各位老师您能具体给看看吗?谢谢了
点击下载此附件 这个是例子请看看,感谢,感谢
谢谢大家问题解决了
总记录:4篇 页次:1/1 9 1 :