Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    delete all modules (Access 2000)

    Is there a function deleting all modules? I am deleting the modules one by one with:
    DoCmd.DeleteObject acModule, "Module1"
    I am interested to knwo can i delete all the modules present without enumerating them?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: delete all modules (Access 2000)

    If you delete ALL modules you will also delete the module that contains the code to delete all modules! <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

    The following procedure will delete all modules. Replace basThisOne with the name of the module that contains the DeleteModules code. If you don't want to delete the module that contains DeleteModules, comment out the line above End Sub.

    Sub DeleteModules()
    Dim i As Long
    Dim n As Long
    n = CurrentProject.AllModules.Count
    For i = n - 1 To 0 Step -1
    If Not CurrentProject.AllModules(i).Name = "basThisOne" Then
    DoCmd.DeleteObject acModule, CurrentProject.AllModules(i).Name
    End If
    Next i
    ' This line will delete the module that contains the code
    DoCmd.DeleteObject acModule, "basThisOne"
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •