gpt4 book ai didi

ms-access - Access 2000 - 删除多个表单?

转载 作者:行者123 更新时间:2023-12-02 09:00:00 24 4
gpt4 key购买 nike

是否要删除 Access 2000 中的多个表单、查询等? (在设计器中)。

最佳答案

这对我来说效果更好。尝试删除循环本身中的元素一直遇到麻烦。我只是将对象名称放入一个数组中,然后将其删除。

Public Sub DeleteAllFormsAndReports()

Dim accobj As AccessObject
Dim X As Integer
Dim iObjCount As Integer
Dim sObjectNames() As String

If MsgBox("Are you sure you want to delete all of the forms and reports?", vbCritical + vbYesNo) = vbYes Then
ReDim sObjectNames(0)
For Each accobj In CurrentProject.AllForms
ReDim Preserve sObjectNames(UBound(sObjectNames) + 1)
sObjectNames(UBound(sObjectNames)) = accobj.Name
Next accobj

For X = 1 To UBound(sObjectNames)
DoCmd.DeleteObject acForm, sObjectNames(X)
Next X

ReDim sObjectNames(0)
For Each accobj In CurrentProject.AllReports
ReDim Preserve sObjectNames(UBound(sObjectNames) + 1)
sObjectNames(UBound(sObjectNames)) = accobj.Name
Next accobj

For X = 1 To UBound(sObjectNames)
DoCmd.DeleteObject acReport, sObjectNames(X)
Next X

End If

结束子

关于ms-access - Access 2000 - 删除多个表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2043672/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com