?
Solved

Copy file based on check box in MS Access Table

Posted on 2012-04-13
2
Medium Priority
?
211 Views
Last Modified: 2012-04-13
I need to copy files from Folder A to Folder B, but I only want to copy files based on whether or not a specific attribute exists in a table.  I have a table (Table 1) that contains two attribute fields: "File Name" and "Replace" (the "Replace" field is a Yes/No (check-box) field).  I would like to loop through the records in the table, and copy each file listed in the table, (based on on the file name), where the "Replace" attribute is checked.

I don't know if this makes any sense, or if it's even possible, but I figure that I doesn't hurt to ask.

Thank you in advance.
0
Comment
Question by:giswest
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 37843169
use recordsets

dim rs as dao.recordset, strSource, strDest
strSource="c:\FolderA\"
 strDest="c:\FolderB\"
set rs=currentdb.openrecordset("select * from table1 where replace=true")

if rs.eof then exit sub

do until rs.eof
       filecopy strsource & rs![File Name], strDest & rs![File Name]

rs.movenext
loop
0
 

Author Closing Comment

by:giswest
ID: 37843551
capricorn1,

Awsome response and solution, as usual!  I had not even considered filtering the records when defining the recordset.  I'll definitely store this one in memory banks for future reference.

Have a good weekend.
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question