Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Aug 2005
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    If Not (Access 2000)

    In my code to export macros export all macroes besides Autoexecupsize.
    For Each mcr In CurrentProject.AllMacros
    If Not mcr.Name = "AutoexecUpsize" Then
    DoCmd.TransferDatabase acExport, "Microsoft Access", DBName, acMacro, mcr.Name, mcr.Name
    End If
    How can i add a second macro not to be exported, something like
    If Not mcr.Name = "AutoexecUpsize" And Not mcr.Name BufferAutoexec Then
    becasue i get an error

  2. #2
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If Not (Access 2000)

    If I understand correctly what you are trying to do, you could try nesting the if statements:

    If Not mcr.Name = "AutoexecUpsize" Then
    If Not mcr.Name = "BufferAutoexec" Then
    DoCmd.TransferDatabase acExport, "Microsoft Access", DBName, acMacro, mcr.Name, mcr.Name
    endif
    endif

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: If Not (Access 2000)

    Either:
    <code>If mcr.Name <> "AutoexecUpsize" And mcr.Name <> "BufferAutoexec" Then</code>

    or:
    <pre>Select Case mcr.Name
    Case "AutoexecUpsize", "BufferAutoexec"
    ' Do nothing
    Case Else
    DoCmd.TransferDatabase acExport, "Microsoft Access", DBName, _
    acMacro, mcr.Name, mcr.Name
    End Select
    </pre>

    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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