以下是引用aydl1014在2006-10-27 10:04:00的发言:
还可以这样写,代码比较简练
CurrentProject.Connection.Execute "DELETE * FROM 临时表;"
CurrentProject.Connection.Execute "INSERT INTO 临时表(表名) SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~') AND (Left$([Name],4) <> 'Msys') AND Name<>'临时表'AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name;"
CurrentProject.Connection.Execute "update 临时表 set 记录数=dcount('[编号]',表名);"
DoCmd.OpenTable "临时表"
以下是引用aydl1014在2006-10-27 10:04:00的发言:
还可以这样写,代码比较简练
CurrentProject.Connection.Execute "DELETE * FROM 临时表;"
CurrentProject.Connection.Execute "INSERT INTO 临时表(表名) SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>'~') AND (Left$([Name],4) <> 'Msys') AND Name<>'临时表'AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name;"
CurrentProject.Connection.Execute "update 临时表 set 记录数=dcount('[编号]',表名);"
DoCmd.OpenTable "临时表"
以下是引用aydl1014在2006-10-27 8:23:00的发言:
谢谢wuaza,空格没问题(估计是论坛自动排版的原因),关键是没有rst.update,已成功了
ATA,你可以看这个例子,需要建一个表,命名为“临时表”,含两列:表名、记录数[attach]21184[/attach]
以下是引用wuaza在2006-10-26 16:27:00的发言:
Private Sub count()
Dim i As Variant
For Each i In Application.CurrentData.AllTables
If Left(i.Name, 4) <> "Msys" Then
If DCount("*", i.Name) > 0 Then
MsgBox i.Name & "共有记录数" & DCount("*", i.Name) & "条"
End If
End If
Next
End Sub
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) | Powered by Discuz! X3.3 |