Results 1 to 3 of 3
  1. #1
    asmith533 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2012
    Posts
    13

    Create macro to import a text file

    I'm trying to figure out the best way to do this. We have meetings that are documented using a scanner to scan attendees IDs. When we are done, we may or may not download the data immediately. Sometimes there may be 2 or 3 meetings at a time stored on the scanner. When we import the data from the scanner, it comes in the form of a txt file with the attendees' ID # and the date/time that the meeting was attended. There may be more than one event that day, at different times.

    I have a table for meetings, with MeetingID, MeetingTitle, MeetingDate, MeetingTime
    I have a table for attendees with AttendeeID, FirstName, LastName....
    I have a linking table for the meeting attendance with MeetingID and AttendeeID.

    This is the table I want to import the text file into. What I would like to do is create a form where you select the meeting from a drop down (I have that one covered lol), then have a button that when clicked will prompt for file location, pull the file in, only pick the entries that happened within the time frame of the meeting, and for every line item, assign the meeting ID to it. Am I over reaching or is this possible?



    Thanks for any help or advice!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    All is possible, by several methods.

    However, your selection parameters for the import will mean more complicated code.

    Take one step at a time. The first was the working dropdown. Now get the prompt for file location working. Probably want to explore FileDialog. A fairly common topic. https://www.accessforums.net/program...ice-48264.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    The import of a txt file - is relatively simple using the manual steps offered in the product; beginning with the External tab in the ribbon - where one steps thru it led by the wizard. At the very end of that wizard sequence you are offered to save your manual steps with a name.

    If the imported file will always be in the same location and have the same name and have the same layout - then that saved import name can be used to run it on a single button press. One of the options of a macro behind a command button is 'Run ImportExport' whereby you would select the name that you gave it.

    If that imported file however is going to be in different locations and have different names - then you get into more advanced custom coding involving File Dialog.

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

Similar Threads

  1. Replies: 1
    Last Post: 10-24-2014, 05:55 AM
  2. Replies: 3
    Last Post: 10-08-2014, 11:05 AM
  3. Import Excel File using a Macro
    By smakkiee in forum Access
    Replies: 6
    Last Post: 04-28-2014, 08:45 AM
  4. Import Excel File Using Macro?
    By oregoncrete in forum Import/Export Data
    Replies: 0
    Last Post: 04-05-2011, 12:26 PM
  5. Question on Macro to automate file import
    By delkath in forum Access
    Replies: 4
    Last Post: 05-25-2010, 04:28 AM

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