Solved

Copy file based on check box in MS Access Table

Posted on 2012-04-13
2
209 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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

726 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