是清空所有表中数据记录,不是清空选择单个表的数据,大家慎用,一次性删除所有表中的记录,代码如下Function ClearAllData() Dim rst As Object DoCmd.SetWarnings False Set rst = CreateObject("ADODB.Recordset") rst.Source = "Select [Name] FROM MSysObjects Where Type=1 AND Not[Name] Like 'MSys%'" rst.Open , CurrentProject.Connection Do Until rst.EOF DoCmd.RunSQL "Delete FROM [" & rst![Name] &"]" rst.MoveNext Loop rst.Close DoCmd.SetWarnings TrueEnd Function
共 1 个关于本帖的回复 最后回复于 2013-7-4 12:08