Results 1 to 9 of 9
  1. #1
    Zdz16 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    16

    Periodic importing file in the background.

    Hi friends;

    I still need your help to implement a detection of the arrival of a file in a known directory. I have an Access 2010 database in which I have to periodically import data from a text file in a specific table. However, I would like to do this automatically when the base is open and without the intervention of the user. I think to a VBA procedure that runs periodically to detect the file and import it if it is in the directory, this in the background without penalizing the user.

    Is this possible with VBA?
    Do you have links or example that discussed on this topic ?



    Thanks in advance for your help

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Have you considered the Dir() function?

  3. #3
    Zdz16 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    16
    Thinks for you Replay;

    Yes, I know the function and I used it already.
    My question is for the initiation of the execution of the procedure. I have no idea how to achieve this. It means, cause the periodic execution of the procedure without intervention.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You could use a form's timer. You could create your own timer in VBA that uses the machines system clock. The issue with this approach is that timers are resource hogs. Perhaps the best approach would be to use Task Scheduler to launch some VB script to open an Access file. Have the Access file check the directory and take the necessary action if found. Have the Task Scheduler close the VBS file after a predetermined amount of time.

  5. #5
    Zdz16 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    16
    Your idea is might work. But I forgot to specify that when the file arrives in the directory, the DB is used by one or more users. I think I'll start by putting an option in the menu that the user initiates the importing periodically. This waiting to find an alternative.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by Zdz16 View Post
    ..the DB is used by one or more users...
    My suggestion would require an FE that would be dedicated to the process.

  7. #7
    Zdz16 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    16
    Can you please, explaine the word 'FE'

    B.R.

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    It is typical to have a Front End file to handle the Application or "Public Interface" part and a Back End file to manage the data tables. The users will open the FE file and the FE file will link to one or more BE files.

    It is also common to have FE files that perform specific functions. For instance, an FE that is designed for Operations may not be the same file as the one for HR or Payroll. It is best to have each user use their own FE file on their local machine/client. Some or all FE files will be a similar version where others may be different.

    Create an FE that resides on a machine that has the available resources to manage the Scheduled Task and the procedure.

  9. #9
    Zdz16 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    16
    Thanks much for these explanations.

    Cheers on the forum.
    Bye

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 02-05-2014, 04:25 AM
  2. Importing file directly from a Sharepoint file (not list)
    By jstoler in forum Import/Export Data
    Replies: 1
    Last Post: 06-28-2013, 01:44 PM
  3. Importing CSV file using VBA
    By falconfox in forum Import/Export Data
    Replies: 1
    Last Post: 12-05-2012, 10:32 PM
  4. Replies: 3
    Last Post: 10-11-2012, 10:12 AM
  5. Periodic Query
    By BigCat in forum Queries
    Replies: 4
    Last Post: 05-11-2011, 03:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums