Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Nov 2007
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Substitute constant (Access 2000)

    Could you help me replace the path through a constant in a code? the following line is OK and works excellent:
    Shell """C:Program FilesWinZipWZzip.exe"" C:BEMGPFrontEndszzz C:BEHouse.mdb"
    I wnat to create a constant and replace the constant in the code :
    Private Const FPath = "C:BEMGPFrontEnds"
    Replacing the constant i get no message error but nothing happens:
    Shell """C:Program FilesWinZipWZzip.exe"" FPathzzz C:BEHouse.mdb"
    What is the reason for that ?

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

    Re: Substitute constant (Access 2000)

    Because the name of the constant is inside the quotes, VBA doesn't recognize it. You must place the constant outside the quotes and concatenate the parts:
    <code>
    Shell """C:Program FilesWinZipWZzip.exe"" " & FPath & "zzz C:BEHouse.mdb"</code>

  3. #3
    New Lounger
    Join Date
    Nov 2007
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Substitute constant (Access 2000)

    Thank a lot. It works great.I tried to follow your suggestion in rebuilding the code line.I want to place also the original file to be zipped also in the same direcotry, i.e. the
    FEPath.I came to the following line :
    Shell """C:Program FilesWinZipWZzip.exe"" " & FPath & "zzz FEPath & " House.mdb

    Again no error appeared but nothing happens.Obviuously tthere should be added some commas at the end of the line ?

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

    Re: Substitute constant (Access 2000)

    Once again, you've placed the name of a constant inside the quotes. I already explained that you should place constants (and variables) outside the quotes, and use & to concatenate the parts.
    <code>
    Shell """C:Program FilesWinZipWZzip.exe"" " & FPath & "zzz " & FEPath & "House.mdb"</code>

  5. #5
    New Lounger
    Join Date
    Nov 2007
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Substitute constant (Access 2000)

    I beg to be apologized but i am so grateful !! The code is flying now
    i wish you all the best

Posting Permissions

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