Help for a friend (I don't know where to start!)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sara

    Help for a friend (I don't know where to start!)

    I have a friend doing some pro-bono work for a non-profit that does
    job training for distressed kids under DCSS care. He asked me for
    code to do the following (he's using A2003).

    I can't find code in searches or on the MVP and tool sites I visited -
    though I might not understand that there is code that just needs
    adaptation. ALL help is appreciated.

    He wants a routine (that I'd put into a module) to do the following:

    The on-line application puts files in the folder every 15 minutes with
    a file name & date/time stamp as part of the name, so the file name is
    different every time.

    He wants the routine to check the folder about every minute (so I also
    need to know how to do that)

    1) Open folder on server.

    2) Are there any files in the folder, if no end
    a. If yes, get first filename

    b. Import filename to specified table *This doesn't make
    sense to me, so I assume he wants the file imported but I will have to
    check on that for more specifics.

    c. Delete filename ** I think he wants to delete the file
    from this folder, not the just the name, so the file won't be there
    the next time the routine executes

    d. Get next filename, if none, end.

    Thanks, everyone!
    Sara
  • Tony Toews [MVP]

    #2
    Re: Help for a friend (I don't know where to start!)

    sara <saraqpost@yaho o.comwrote:
    >I can't find code in searches or on the MVP and tool sites I visited -
    >though I might not understand that there is code that just needs
    >adaptation. ALL help is appreciated.
    >1) Open folder on server.
    >
    >2) Are there any files in the folder, if no end
    a. If yes, get first filename
    See the Dir command in VBA help.

    While highly unlikely if you are running Dir in a loop and call another subroutine
    which in turn uses Dir the second set of calls will wipe out the pointer of the first
    set of Dir calls.
    b. Import filename to specified table *This doesn't make
    >sense to me, so I assume he wants the file imported but I will have to
    >check on that for more specifics.
    Rename in VBA cmd
    c. Delete filename ** I think he wants to delete the file
    >from this folder, not the just the name, so the file won't be there
    >the next time the routine executes
    Kill
    d. Get next filename, if none, end.
    Dir again but with an empty string.

    Tony
    --
    Tony Toews, Microsoft Access MVP
    Please respond only in the newsgroups so that others can
    read the entire thread of messages.
    Microsoft Access Links, Hints, Tips & Accounting Systems at

    Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

    Comment

    • sara

      #3
      Re: Help for a friend (I don't know where to start!)

      On Nov 9, 3:01 pm, "Tony Toews [MVP]" <tto...@teluspl anet.netwrote:
      sara <saraqp...@yaho o.comwrote:
      I can't find code in searches or on the MVP and tool sites I visited -
      though I might not understand that there is code that just needs
      adaptation.  ALL help is appreciated.
      1)   Open folder on server.
      >
      2)  Are there any files in the folder, if no end
              a. If yes, get first filename
      >
      See the Dir command in VBA help.  
      >
      While highly unlikely if you are running Dir in a loop and call another subroutine
      which in turn uses Dir the second set of calls will wipe out the pointer of the first
      set of Dir calls.
      >
              b. Import filename to specified table  *This doesn't make
      sense to me, so I assume he wants the file imported but I will have to
      check on that for more specifics.
      >
      Rename in VBA cmd
      >
              c. Delete filename  ** I think he wants to delete thefile
      from this folder, not the just the name, so the file won't be there
      the next time the routine executes
      >
      Kill
      >
              d. Get next filename, if none, end.
      >
      Dir again but with an empty string.
      >
      Tony
      --
      Tony Toews, Microsoft Access MVP
         Please respond only in the newsgroups so that others can
      read the entire thread of messages.
         Microsoft Access Links, Hints, Tips & Accounting Systems athttp://www.granite.ab. ca/accsmstr.htm
         Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/
      I've looked at this and have a few questions:

      Why use Rename? That would put a file out there and it would be
      "picked up" again in the next 60 seconds. Could he use
      filename.delete ? I figure he'd have the filename, with the path,
      which we could create as a variable in the code. Then could he say:
      strFileName.del ete? Or Kill strFileName? (Is Kill better? - I had
      never heard of it)

      Is the Timer function used to run a module every 60 seconds? I will
      mention to him the risk with every 60 seconds, and perhaps he can go
      to 5 minutes or something. I read one post that seemed to indicate we
      should create a form that will always be open I guess it would have to
      be hidden), Set the TimerInterval property to something like 60000
      (check once every 60 seconds). Put this code (or call to the module)
      in the OnTimer event procedure.

      I think I understand DIR - it's a little hard for me because they way
      I learn is to try and this isn't my app (I am even more impressed now
      with how all you MVPs are so well able to offer help!).

      Thanks for getting us started!
      sara


      Comment

      • Phil Stanton

        #4
        Re: Help for a friend (I don't know where to start!)

        You might have a look at



        Phil

        "sara" <saraqpost@yaho o.comwrote in message
        news:5a03f897-db38-4b71-9478-39b76eccb1f4@h2 3g2000prf.googl egroups.com...
        On Nov 9, 3:01 pm, "Tony Toews [MVP]" <tto...@teluspl anet.netwrote:
        sara <saraqp...@yaho o.comwrote:
        I can't find code in searches or on the MVP and tool sites I visited -
        though I might not understand that there is code that just needs
        adaptation. ALL help is appreciated.
        1) Open folder on server.
        >
        2) Are there any files in the folder, if no end
        a. If yes, get first filename
        >
        See the Dir command in VBA help.
        >
        While highly unlikely if you are running Dir in a loop and call another
        subroutine
        which in turn uses Dir the second set of calls will wipe out the pointer
        of the first
        set of Dir calls.
        >
        b. Import filename to specified table *This doesn't make
        sense to me, so I assume he wants the file imported but I will have to
        check on that for more specifics.
        >
        Rename in VBA cmd
        >
        c. Delete filename ** I think he wants to delete the file
        from this folder, not the just the name, so the file won't be there
        the next time the routine executes
        >
        Kill
        >
        d. Get next filename, if none, end.
        >
        Dir again but with an empty string.
        >
        Tony
        --
        Tony Toews, Microsoft Access MVP
        Please respond only in the newsgroups so that others can
        read the entire thread of messages.
        Microsoft Access Links, Hints, Tips & Accounting Systems
        athttp://www.granite.ab. ca/accsmstr.htm
        Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/
        I've looked at this and have a few questions:

        Why use Rename? That would put a file out there and it would be
        "picked up" again in the next 60 seconds. Could he use
        filename.delete ? I figure he'd have the filename, with the path,
        which we could create as a variable in the code. Then could he say:
        strFileName.del ete? Or Kill strFileName? (Is Kill better? - I had
        never heard of it)

        Is the Timer function used to run a module every 60 seconds? I will
        mention to him the risk with every 60 seconds, and perhaps he can go
        to 5 minutes or something. I read one post that seemed to indicate we
        should create a form that will always be open I guess it would have to
        be hidden), Set the TimerInterval property to something like 60000
        (check once every 60 seconds). Put this code (or call to the module)
        in the OnTimer event procedure.

        I think I understand DIR - it's a little hard for me because they way
        I learn is to try and this isn't my app (I am even more impressed now
        with how all you MVPs are so well able to offer help!).

        Thanks for getting us started!
        sara



        Comment

        • sara

          #5
          Re: Help for a friend (I don't know where to start!)

          On Nov 9, 5:43 pm, "Phil Stanton" <p...@myfamilyn ame.co.ukwrote:
          You might have a look at
          >

          >
          Phil
          >
          "sara" <saraqp...@yaho o.comwrote in message
          >
          news:5a03f897-db38-4b71-9478-39b76eccb1f4@h2 3g2000prf.googl egroups.com...
          On Nov 9, 3:01 pm, "Tony Toews [MVP]" <tto...@teluspl anet.netwrote:
          >
          >
          >
          >
          >
          sara <saraqp...@yaho o.comwrote:
          >I can't find code in searches or on the MVP and tool sites I visited -
          >though I might not understand that there is code that just needs
          >adaptation. ALL help is appreciated.
          >1) Open folder on server.
          >
          >2) Are there any files in the folder, if no end
          a. If yes, get first filename
          >
          See the Dir command in VBA help.
          >
          While highly unlikely if you are running Dir in a loop and call another
          subroutine
          which in turn uses Dir the second set of calls will wipe out the pointer
          of the first
          set of Dir calls.
          >
          b. Import filename to specified table *This doesn't make
          >sense to me, so I assume he wants the file imported but I will have to
          >check on that for more specifics.
          >
          Rename in VBA cmd
          >
          c. Delete filename ** I think he wants to delete the file
          >from this folder, not the just the name, so the file won't be there
          >the next time the routine executes
          >
          Kill
          >
          d. Get next filename, if none, end.
          >
          Dir again but with an empty string.
          >
          Tony
          --
          Tony Toews, Microsoft Access MVP
          Please respond only in the newsgroups so that others can
          read the entire thread of messages.
          Microsoft Access Links, Hints, Tips & Accounting Systems
          athttp://www.granite.ab. ca/accsmstr.htm
          Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/
          >
          I've looked at this and have a few questions:
          >
          Why use Rename?  That would put a file out there and it would be
          "picked up" again in the next 60 seconds.  Could he use
          filename.delete ?  I figure he'd have the filename, with the path,
          which we could create as a variable in the code.  Then could he say:
          strFileName.del ete?  Or Kill strFileName?  (Is Kill better? - I had
          never heard of it)
          >
          Is the Timer function used to run a module every 60 seconds?  I will
          mention to him the risk with every 60 seconds, and perhaps he can go
          to 5 minutes or something.  I read one post that seemed to indicate we
          should create a form that will always be open I guess it would have to
          be hidden), Set the TimerInterval property to something like 60000
          (check once every 60 seconds).  Put this code (or call to the module)
          in the OnTimer event procedure.
          >
          I think I understand DIR  - it's a little hard for me because they way
          I learn is to try and this isn't my app (I am even more impressed now
          with how all you MVPs are so well able to offer help!).
          >
          Thanks for getting us started!
          sara- Hide quoted text -
          >
          - Show quoted text -
          Hi Phil -
          I looked at that, but I don't understand how it relates to what I'm
          looking for. I do't really understand what an API is, or if that's
          what is needed in this case, either. Sorry - I'm new to a lot of
          this.

          Sara

          Comment

          • Salad

            #6
            Re: Help for a friend (I don't know where to start!)

            sara wrote:
            On Nov 9, 5:43 pm, "Phil Stanton" <p...@myfamilyn ame.co.ukwrote:
            >
            >>You might have a look at
            >>
            >>http://allapi.mentalis.org/apilist/F...fication.shtml
            >>
            >>Phil
            >>
            >>"sara" <saraqp...@yaho o.comwrote in message
            >>
            >>news:5a03f8 97-db38-4b71-9478-39b76eccb1f4@h2 3g2000prf.googl egroups.com...
            >>On Nov 9, 3:01 pm, "Tony Toews [MVP]" <tto...@teluspl anet.netwrote:
            >>
            >>
            >>
            >>
            >>
            >>
            >>>sara <saraqp...@yaho o.comwrote:
            >>>
            >>>>I can't find code in searches or on the MVP and tool sites I visited -
            >>>>though I might not understand that there is code that just needs
            >>>>adaptatio n. ALL help is appreciated.
            >>>>1) Open folder on server.
            >>
            >>>>2) Are there any files in the folder, if no end
            >>>>a. If yes, get first filename
            >>
            >>>See the Dir command in VBA help.
            >>
            >>>While highly unlikely if you are running Dir in a loop and call another
            >>>subroutine
            >>>which in turn uses Dir the second set of calls will wipe out the pointer
            >>>of the first
            >>>set of Dir calls.
            >>
            >>>>b. Import filename to specified table *This doesn't make
            >>>>sense to me, so I assume he wants the file imported but I will have to
            >>>>check on that for more specifics.
            >>
            >>>Rename in VBA cmd
            >>
            >>>>c. Delete filename ** I think he wants to delete the file
            >>>
            >>>>from this folder, not the just the name, so the file won't be there
            >>>
            >>>>the next time the routine executes
            >>
            >>>Kill
            >>
            >>>>d. Get next filename, if none, end.
            >>
            >>>Dir again but with an empty string.
            >>
            >>>Tony
            >>>--
            >>>Tony Toews, Microsoft Access MVP
            >>>Please respond only in the newsgroups so that others can
            >>>read the entire thread of messages.
            >>>Microsoft Access Links, Hints, Tips & Accounting Systems
            >>>athttp://www.granite.ab. ca/accsmstr.htm
            >>>Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/
            >>
            >>I've looked at this and have a few questions:
            >>
            >>Why use Rename? That would put a file out there and it would be
            >>"picked up" again in the next 60 seconds. Could he use
            >>filename.dele te? I figure he'd have the filename, with the path,
            >>which we could create as a variable in the code. Then could he say:
            >>strFileName.d elete? Or Kill strFileName? (Is Kill better? - I had
            >>never heard of it)
            >>
            >>Is the Timer function used to run a module every 60 seconds? I will
            >>mention to him the risk with every 60 seconds, and perhaps he can go
            >>to 5 minutes or something. I read one post that seemed to indicate we
            >>should create a form that will always be open I guess it would have to
            >>be hidden), Set the TimerInterval property to something like 60000
            >>(check once every 60 seconds). Put this code (or call to the module)
            >>in the OnTimer event procedure.
            >>
            >>I think I understand DIR - it's a little hard for me because they way
            >>I learn is to try and this isn't my app (I am even more impressed now
            >>with how all you MVPs are so well able to offer help!).
            >>
            >>Thanks for getting us started!
            >>sara- Hide quoted text -
            >>
            >>- Show quoted text -
            >
            >
            Hi Phil -
            I looked at that, but I don't understand how it relates to what I'm
            looking for. I do't really understand what an API is, or if that's
            what is needed in this case, either. Sorry - I'm new to a lot of
            this.
            >
            Sara
            Some of this might help you get started. In a form you have a timer
            interval.

            In the Form's property sheet the event OnTimer fires if there is a value
            in TimerInterval. TimerInterval is input is in milliseconds. One
            second is 1000. One minute is 60,000. Set the value to however long
            you want the event to "pause" before firing.

            In the OnTimer event you will want to check for files. This is some air
            code. Assumes timerinterval is 60000.

            Private Sub Form_Timer()
            'stop the OnTimer event from starting again until processing is complete
            Me.TimerInterna l = 0

            Dim strFolder As String
            Dim strSourceFile 'file path & name
            Dim strDestFile As String 'file path & name to be copied to
            Dim strDestFolder As String
            Dim strFile As String 'file name found in Dir()
            Dim strDT as String 'hold the date/time of the dest file
            Dim intPos As Integer

            'what folder do you want to search and process?
            strFolder = "C:\Test\"
            strDestFolder = "C:\CopyFilesTo \"

            'see if there's any files in the search folder
            strFile = Dir(strFolder & "*.*")

            'process files in folder until complete
            Do while strFile ""
            'there's a file
            strSourceFile = strFolder & strFile

            '....process the source file

            'format the date/time to a string value. A filename can't have
            'a colon in it so time is separated with dashes as well
            strDt = format(now(),"m m-dd-yyyy hh-nn-ss")

            'create the destination file name to copy the source file to. Find
            'out where the filename's extension begins. Assumes there is an _
            'extension. Ex: C:\Test\Test.Tx t, might become
            'C:\CopyFilesTo \Test 11-08-2008 11-30-01.Txt" (11-30-01)is the time.
            intPos = Instr(strFile," .")
            strDestFile = strDestFolder & strFile & " " & strDt & _
            Mid(strFile,int Pos)

            'now copy the file to the new destination
            FileCopy strSourceFile, strDestFile

            'now delete the source file
            Kill strSourceFile

            'now get the next file that exists in the folder
            strFile = Dir()
            Loop

            'for testing purpose
            msgbox "Done processing"

            'reset/restart the timer interval
            Me.TimerInterva l = 60000
            End Sub

            Comment

            • sara

              #7
              Re: Help for a friend (I don't know where to start!)

              On Nov 10, 11:41 am, Salad <o...@vinegar.c omwrote:
              sara wrote:
              On Nov 9, 5:43 pm, "Phil Stanton" <p...@myfamilyn ame.co.ukwrote:
              >
              >You might have a look at
              >>
              >Phil
              >
              >"sara" <saraqp...@yaho o.comwrote in message
              >
              >news:5a03f89 7-db38-4b71-9478-39b76eccb1f4@h2 3g2000prf.googl egroups.com....
              >On Nov 9, 3:01 pm, "Tony Toews [MVP]" <tto...@teluspl anet.netwrote:
              >
              >>sara <saraqp...@yaho o.comwrote:
              >
              >>>I can't find code in searches or on the MVP and tool sites I visited -
              >>>though I might not understand that there is code that just needs
              >>>adaptation . ALL help is appreciated.
              >>>1) Open folder on server.
              >
              >>>2) Are there any files in the folder, if no end
              >>>a. If yes, get first filename
              >
              >>See the Dir command in VBA help.
              >
              >>While highly unlikely if you are running Dir in a loop and call another
              >>subroutine
              >>which in turn uses Dir the second set of calls will wipe out the pointer
              >>of the first
              >>set of Dir calls.
              >
              >>>b. Import filename to specified table *This doesn't make
              >>>sense to me, so I assume he wants the file imported but I will have to
              >>>check on that for more specifics.
              >
              >>Rename in VBA cmd
              >
              >>>c. Delete filename ** I think he wants to delete the file
              >
              >>>from this folder, not the just the name, so the file won't be there
              >
              >>>the next time the routine executes
              >
              >>Kill
              >
              >>>d. Get next filename, if none, end.
              >
              >>Dir again but with an empty string.
              >
              >>Tony
              >>--
              >>Tony Toews, Microsoft Access MVP
              >>Please respond only in the newsgroups so that others can
              >>read the entire thread of messages.
              >>Microsoft Access Links, Hints, Tips & Accounting Systems
              >>athttp://www.granite.ab. ca/accsmstr.htm
              >>Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/
              >
              >I've looked at this and have a few questions:
              >
              >Why use Rename?  That would put a file out there and it would be
              >"picked up" again in the next 60 seconds.  Could he use
              >filename.delet e?  I figure he'd have the filename, with the path,
              >which we could create as a variable in the code.  Then could he say:
              >strFileName.de lete?  Or Kill strFileName?  (Is Kill better? - I had
              >never heard of it)
              >
              >Is the Timer function used to run a module every 60 seconds?  I will
              >mention to him the risk with every 60 seconds, and perhaps he can go
              >to 5 minutes or something.  I read one post that seemed to indicate we
              >should create a form that will always be open I guess it would have to
              >be hidden), Set the TimerInterval property to something like 60000
              >(check once every 60 seconds).  Put this code (or call to the module)
              >in the OnTimer event procedure.
              >
              >I think I understand DIR  - it's a little hard for me because they way
              >I learn is to try and this isn't my app (I am even more impressed now
              >with how all you MVPs are so well able to offer help!).
              >
              >Thanks for getting us started!
              >sara- Hide quoted text -
              >
              >- Show quoted text -
              >
              Hi Phil -
              I looked at that, but I don't understand how it relates to what I'm
              looking for.  I do't really understand what an API is, or if that's
              what is needed in this case, either.  Sorry - I'm new to a lot of
              this.
              >
              Sara
              >
              Some of this might help you get started.  In a form you have a timer
              interval.
              >
              In the Form's property sheet the event OnTimer fires if there is a value
              in TimerInterval.  TimerInterval is input is in milliseconds.  One
              second is 1000.  One minute is 60,000.  Set the value to however long
              you want the event to "pause" before firing.
              >
              In the OnTimer event you will want to check for files.  This is some air
              code.  Assumes timerinterval is 60000.
              >
              Private Sub Form_Timer()
              'stop the OnTimer event from starting again until processing is complete
              Me.TimerInterna l = 0
              >
              Dim strFolder As String
              Dim strSourceFile         'file path & name
              Dim strDestFile As String 'file path & name to be copied to
              Dim strDestFolder As String
              Dim strFile As String 'file name found in Dir()
              Dim strDT as String  'hold the date/time of the dest file
              Dim intPos As Integer
              >
              'what folder do you want to search and process?
              strFolder = "C:\Test\"
              strDestFolder = "C:\CopyFilesTo \"
              >
              'see if there's any files in the search folder
              strFile = Dir(strFolder & "*.*")
              >
              'process files in folder until complete
              Do while strFile ""
                 'there's a file
                 strSourceFile = strFolder & strFile
              >
                 '....process the source file
              >
                 'format the date/time to a string value.  A filename can't have
                 'a colon in it so time is separated with dashes as well
                 strDt = format(now(),"m m-dd-yyyy hh-nn-ss")
              >
                 'create the destination file name to copy the source file to.  Find
                 'out where the filename's extension begins.  Assumes there is an_
                 'extension.  Ex:  C:\Test\Test.Tx t, might become
                 'C:\CopyFilesTo \Test 11-08-2008 11-30-01.Txt"  (11-30-01)is the time.
                 intPos = Instr(strFile," .")
                 strDestFile = strDestFolder & strFile & " " &  strDt & _
                   Mid(strFile,int Pos)
              >
                 'now copy the file to the new destination            
                 FileCopy strSourceFile, strDestFile
              >
                 'now delete the source file
                 Kill strSourceFile
              >
                 'now get the next file that exists in the folder
                 strFile = Dir()
              Loop
              >
              'for testing purpose
              msgbox "Done processing"
              >
              'reset/restart the timer interval
              Me.TimerInterva l = 60000
              End Sub- Hide quoted text -
              >
              - Show quoted text -
              Thanks, Salad - And Phil and Tony.
              I worked with my friend using bits and pieces of all this and he
              thinks he's got it working. MUCH appreciated!

              Until next time -
              Sara

              Comment

              • Salad

                #8
                Re: Help for a friend (I don't know where to start!)

                sara wrote:
                On Nov 10, 11:41 am, Salad <o...@vinegar.c omwrote:
                >
                >>sara wrote:
                >>
                >>>On Nov 9, 5:43 pm, "Phil Stanton" <p...@myfamilyn ame.co.ukwrote:
                >>
                >>>>You might have a look at
                >>>>
                >>>>Phil
                >>
                >>>>"sara" <saraqp...@yaho o.comwrote in message
                >>
                >>>>news:5a03f8 97-db38-4b71-9478-39b76eccb1f4@h2 3g2000prf.googl egroups.com...
                >>>>On Nov 9, 3:01 pm, "Tony Toews [MVP]" <tto...@teluspl anet.netwrote:
                >>
                >>>>>sara <saraqp...@yaho o.comwrote:
                >>
                >>>>>>I can't find code in searches or on the MVP and tool sites I visited -
                >>>>>>though I might not understand that there is code that just needs
                >>>>>>adaptatio n. ALL help is appreciated.
                >>>>>>1) Open folder on server.
                >>
                >>>>>>2) Are there any files in the folder, if no end
                >>>>>>a. If yes, get first filename
                >>
                >>>>>See the Dir command in VBA help.
                >>
                >>>>>While highly unlikely if you are running Dir in a loop and call another
                >>>>>subrouti ne
                >>>>>which in turn uses Dir the second set of calls will wipe out the pointer
                >>>>>of the first
                >>>>>set of Dir calls.
                >>
                >>>>>>b. Import filename to specified table *This doesn't make
                >>>>>>sense to me, so I assume he wants the file imported but I will have to
                >>>>>>check on that for more specifics.
                >>
                >>>>>Rename in VBA cmd
                >>
                >>>>>>c. Delete filename ** I think he wants to delete the file
                >>
                >>>>>>from this folder, not the just the name, so the file won't be there
                >>
                >>>>>>the next time the routine executes
                >>
                >>>>>Kill
                >>
                >>>>>>d. Get next filename, if none, end.
                >>
                >>>>>Dir again but with an empty string.
                >>
                >>>>>Tony
                >>>>>--
                >>>>>Tony Toews, Microsoft Access MVP
                >>>>>Please respond only in the newsgroups so that others can
                >>>>>read the entire thread of messages.
                >>>>>Microsof t Access Links, Hints, Tips & Accounting Systems
                >>>>>athttp://www.granite.ab. ca/accsmstr.htm
                >>>>>Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/
                >>
                >>>>I've looked at this and have a few questions:
                >>
                >>>>Why use Rename? That would put a file out there and it would be
                >>>>"picked up" again in the next 60 seconds. Could he use
                >>>>filename.de lete? I figure he'd have the filename, with the path,
                >>>>which we could create as a variable in the code. Then could he say:
                >>>>strFileName .delete? Or Kill strFileName? (Is Kill better? - I had
                >>>>never heard of it)
                >>
                >>>>Is the Timer function used to run a module every 60 seconds? I will
                >>>>mention to him the risk with every 60 seconds, and perhaps he can go
                >>>>to 5 minutes or something. I read one post that seemed to indicate we
                >>>>should create a form that will always be open I guess it would have to
                >>>>be hidden), Set the TimerInterval property to something like 60000
                >>>>(check once every 60 seconds). Put this code (or call to the module)
                >>>>in the OnTimer event procedure.
                >>
                >>>>I think I understand DIR - it's a little hard for me because they way
                >>>>I learn is to try and this isn't my app (I am even more impressed now
                >>>>with how all you MVPs are so well able to offer help!).
                >>
                >>>>Thanks for getting us started!
                >>>>sara- Hide quoted text -
                >>
                >>>>- Show quoted text -
                >>
                >>>Hi Phil -
                >>>I looked at that, but I don't understand how it relates to what I'm
                >>>looking for. I do't really understand what an API is, or if that's
                >>>what is needed in this case, either. Sorry - I'm new to a lot of
                >>>this.
                >>
                >>>Sara
                >>
                >>Some of this might help you get started. In a form you have a timer
                >>interval.
                >>
                >>In the Form's property sheet the event OnTimer fires if there is a value
                >>in TimerInterval. TimerInterval is input is in milliseconds. One
                >>second is 1000. One minute is 60,000. Set the value to however long
                >>you want the event to "pause" before firing.
                >>
                >>In the OnTimer event you will want to check for files. This is some air
                >>code. Assumes timerinterval is 60000.
                >>
                >>Private Sub Form_Timer()
                >>'stop the OnTimer event from starting again until processing is complete
                >>Me.TimerInter nal = 0
                >>
                >>Dim strFolder As String
                >>Dim strSourceFile 'file path & name
                >>Dim strDestFile As String 'file path & name to be copied to
                >>Dim strDestFolder As String
                >>Dim strFile As String 'file name found in Dir()
                >>Dim strDT as String 'hold the date/time of the dest file
                >>Dim intPos As Integer
                >>
                >>'what folder do you want to search and process?
                >>strFolder = "C:\Test\"
                >>strDestFold er = "C:\CopyFilesTo \"
                >>
                >>'see if there's any files in the search folder
                >>strFile = Dir(strFolder & "*.*")
                >>
                >>'process files in folder until complete
                >>Do while strFile ""
                > 'there's a file
                > strSourceFile = strFolder & strFile
                >>
                > '....process the source file
                >>
                > 'format the date/time to a string value. A filename can't have
                > 'a colon in it so time is separated with dashes as well
                > strDt = format(now(),"m m-dd-yyyy hh-nn-ss")
                >>
                > 'create the destination file name to copy the source file to. Find
                > 'out where the filename's extension begins. Assumes there is an _
                > 'extension. Ex: C:\Test\Test.Tx t, might become
                > 'C:\CopyFilesTo \Test 11-08-2008 11-30-01.Txt" (11-30-01)is the time.
                > intPos = Instr(strFile," .")
                > strDestFile = strDestFolder & strFile & " " & strDt & _
                > Mid(strFile,int Pos)
                >>
                > 'now copy the file to the new destination
                > FileCopy strSourceFile, strDestFile
                >>
                > 'now delete the source file
                > Kill strSourceFile
                >>
                > 'now get the next file that exists in the folder
                > strFile = Dir()
                >>Loop
                >>
                >>'for testing purpose
                >>msgbox "Done processing"
                >>
                >>'reset/restart the timer interval
                >>Me.TimerInter val = 60000
                >>End Sub- Hide quoted text -
                >>
                >>- Show quoted text -
                >
                >
                Thanks, Salad - And Phil and Tony.
                I worked with my friend using bits and pieces of all this and he
                thinks he's got it working. MUCH appreciated!
                >
                Until next time -
                Sara
                You are welcome.

                I supplied aircode. I had the line
                strDestFile = strDestFolder & strFile & " " & strDt & _
                Mid(strFile,int Pos)
                but strFile contains an extension so it should be
                strDestFile = strDestFolder & left(strFile,in tPos-1) & " " & _
                strDt & Mid(strFile,int Pos)

                Hopefully you or your friend caught it.

                Comment

                Working...