Copying files

  • Thread starter Thread starter bob
  • Start date Start date
B

bob

I have a linked photo library which is almost perfect. All
my pics are in the same directory and my primary key field
is the filename of each jpg. I also have a checkbox for
printworthy pics. What is the easiest way to copy to my
jpg files (via primary key field) where printworthy = yes
to another directory?

bob
 
You'll have to modify the code but if you use this as an outline and create a query in access that selects only the records with printworthy = yes and call it in the code it will copy all the images to a different directory

Private Sub Command1_Click(
Dim fs1 As FileSystemObjec
Set fs1 = CreateObject("Scripting.FileSystemObject"

Do While Not adoPrimaryRS.EO
On Error Resume Nex
Me.File2.Path = "\\IS\ISWG\CODELIB\Images\" & DataGrid1.Columns(0) & ".jpg
Me.File1.Path = "I:\ISWG\CODELIB\\images\
Me.File1.FileName = DataGrid1.Columns(1
strSource = File1.Path & "\" & DataGrid1.Columns(1
strDest = File2.Path & "\" & DataGrid1.Columns(1
fs1.CopyFile strSource, strDest, Tru

adoPrimaryRS.MoveNex
Loo

MsgBox ("DONE"

End Su

Private Sub Form_Load(
Set db = New ADODB.Connectio
strdb = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=K:\Current Projects\Web.mdb;Mode=ReadWrite;Persist Security Info=False;
db.CursorLocation = adUseClien
db.Open strd

Set adoPrimaryRS = New ADODB.Recordse
Set adoPrimaryRS.ActiveConnection = d
adoPrimaryRS.Open "select page,image from imagelist", db, adOpenKeyset, adLockOptimisti
Set DataGrid1.DataSource = adoPrimaryR
Me.File2.Path = "\\DATA\IS\ISWG\CODELIB\Images\
Me.File1.Path = "I:\ISWG\CODELIB\images\
End Sub
 
Back
Top