我试图调用一个名为 Ins_to_temp 的 VBA 过程,但它不起作用。奇怪,因为 Ins_to_temp 是从另一个过程的模型构建的:Truncate_table 确实有效!
您能帮我理解为什么这会在“Ins_to_temp(x,y,z)”行出现错误 - 它说缺少“=”!(好像它是一个函数,但它显然是一个过程)
Sub Ins_to_temp(tbl1 As String, tbl2 As String, idx As String)
Connect
Dim strQ As String
Set rstR = New ADODB.Recordset
rstR.CursorType = adOpenStatic
strQ = "insert into " & tbl1 & " (select * from " & tbl2 & " where id = '" & idx & "')"
rstRec.Open strQ, objCon, adOpenDynamic, adLockOptimistic
End Sub
Sub Test()
Ins_to_temp("temp_clients","clients","202")
End Sub
作为参考,这里是一个有效的过程:
Sub Truncate_table(tbl1 As String)
Connect
Dim strQ As String
Set rstR = New ADODB.Recordset
rstR.CursorType = adOpenStatic
strQ = "DELETE FROM " & tbl1
rstR.Open strQ, objCon, adOpenDynamic, adLockOptimistic
End Sub
我可以称之为:Truncate_table("coll") 谢谢