Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Enumerating paths (Access 2000)

    How could i enumerate the paths in the simple If Dir(path,vbNormal) condition ? For example i have the following lines :
    If Dir(AuPl, vbNormal) <> "" Then
    GetIt (AuPl)
    Kill (AuPl)
    FncSuborder
    FinishingTouches

    I want to rewrite the If condition as follows

    If Dir(AuPl,or VAOL,Or TrPL,Or TYUL, vbNormal) <> "" Then

    GetIt(AuPl Or VAOL or TrPl Or TYUL)

    Is it possible?

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Enumerating paths (Access 2000)

    What does Getit do?

    What you could do is have a loop that loops thru all files, then test inside the loop for the various filenames you want then do what you want to do.

    What are AuPl Or VAOL or TrPl Or TYUL?

  3. #3
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enumerating paths (Access 2000)

    GetIt is a function that is performed when one of the databases shown with the pah is present.AuPl, VAOL etc are different paths to the databases
    For example the lne
    If Dir("C:BEDepotsDepotVa.mdb", vbNormal) <> "" Then
    can be replaced with
    If Dir(AuPl, vbNormal) <> "" Then...
    In this case AuPl etc is a constant showing the corresponding path

    My question is can i rewrite the If DIR(path,vbNormal) condition so as to include the other path too
    For example If DIR(AUPl, Or VAOL,vbNormal) <> "" Then

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Enumerating paths (Access 2000)

    No you cannot do that as far as i know.
    You may need a separate loop for each path, or setup a function that accepts a path name and do it in one loop in the function.

    you may need to change your Dir function toshow vbDirectory as the 2nd parameter.

  5. #5
    2 Star Lounger
    Join Date
    Sep 2006
    Posts
    166
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enumerating paths (Access 2000)

    Thank you. it is a marvelous solution indeed.Very concize and bullet proofed

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

    Re: Enumerating paths (Access 2000)

    You cannot do it that way. Dir doesn't understand multiple paths. Instead, create a procedure like this:

    Sub ProcessIt(strPath As String)
    If Dir(strPath, vbNormal) <> "" Then
    GetIt strPath
    Kill strPath
    FncSuborder
    FinishingTouches
    End If
    End Sub

    You can then call it like this:

    ProcessIt AUPI
    ProcessIt VAOL
    ProcessIt TRPI
    ProcessIt TYUL

Posting Permissions

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