Results 1 to 7 of 7
  1. #1
    2tMonte is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Louisville, KY
    Posts
    13

    Update Table Based on External File

    I am trying to track whether individuals have a form on file and the numbers are astronomical. I want to create databases to store the info but not hold the actual form on file. This is due to me not wanting to remove/replace the forms when they update on an annual basis. Here is what I am looking for Access to do:
    1. Open an external source


    2. Search for a file name that matches a record within my table
    3. If a file matches, then update a check yes/no box to yes and ignore it if nothing matches

    I am placing this here as a very basic example. I am certain if we can figure out how to do this on a small scale then I can grow this into what I need.


    Click image for larger version. 

Name:	Capture.PNG 
Views:	20 
Size:	5.2 KB 
ID:	11032

    The file would be saved as a .pdf by name in a shared location or MyDocuments. For this example let's say C:\Users\Owner\Documents\Grantham\PL301 so that PL301 is filled with many Name.pdf's.

    So, I want Access to open the folder in my documents and search for a match to the Name Field in my table. If it finds "Chamberlain.pdf" then update the 577 box to yes. If "Chamberlain.pdf" is not found, then leave it as no.

    I know a Macro is going to have to open the data source, search for files that match text in the Name Field, update query on the 577 Field, and keep searching for every Name that has a record. Unfortunately, I am an absolute novice at writing code and queries and am totally lost in the query builder, macro builder, and the modules.

    Any help would be tremendously helpful and a real leap from the labor intensive nonsense I am doing now.

    Thank you.
    Last edited by 2tMonte; 02-01-2013 at 10:09 PM. Reason: Picture of table did not show

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Not a macro, VBA code.

    Review http://allenbrowne.com/func-11.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
    2tMonte is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Louisville, KY
    Posts
    13
    I will have to revisit this after finishing my VBA book. I understand the concept behind what you posted but the intricacies escape me. For instance, one of the strings is FileExists("C:\Data\MyFile.mdb") but what I really need it to do is FileExists("C:\User\My Documents\MemberID.pdf")with MemberID being my primary key. Then it would have to continue to search each primary key until it reached the end of the list. I need to find a way to learn VBA because right now the modules simply confuse me.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Concatenate the MemberID variable. This could be reference to field on form:

    FileExists("C:\User\My Documents\" & Me!MemberID & ".pdf")


    Then you are correct about opening recordset and using a looping structure that reads each record to get the ID's and edit the 577 field. This is getting into a bit more advanced code.

    What is the external source?
    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.

  5. #5
    2tMonte is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Louisville, KY
    Posts
    13
    If by external source you mean where the files are actually stored, it will be a shared network drive eventually. I am trying to learn the schematics with a very simplified version first and using a folder in my documents to test. In the end it would actually be \\xxxxx-xx-xx\CPTF\FMZ\03 - System Accesses\DTS\DD577s\ (x's used for security purposes).

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Then you don't really need to 'open an external source' - just read folders on shared network drive?
    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.

  7. #7
    2tMonte is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Location
    Louisville, KY
    Posts
    13
    Yes, that's it. Why, does that simplify it?

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

Similar Threads

  1. How to select from MDB file through external tools
    By ryanlcs in forum Programming
    Replies: 1
    Last Post: 08-10-2011, 11:31 AM
  2. Exporting Attachments to an external file
    By springa in forum Import/Export Data
    Replies: 3
    Last Post: 07-17-2011, 05:33 AM
  3. Browse to external file while in a form
    By michaeljohnh in forum Import/Export Data
    Replies: 9
    Last Post: 09-22-2010, 09:33 AM
  4. A way to force Access to update external file?
    By gkun in forum Import/Export Data
    Replies: 0
    Last Post: 10-27-2009, 06:11 PM
  5. Replies: 2
    Last Post: 10-27-2009, 07:09 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