[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

MS ACCESSS select all the jpg files and then copy and paste

Posted on 2011-02-23
7
Medium Priority
?
289 Views
Last Modified: 2012-05-11
Good morning,
I work in acces 2007 i have one form and i have make one Botton , then i want to select all the jpg files from one folder and copy with the same name to anather folder.
Thks For your help
0
Comment
Question by:ELPANOS
[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
  • 4
  • 3
7 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 34959522
Sub fc()
Dim SourceFile, DestinationFile
SourceFile = "C:\oldfolder\*.jpg"    ' Define source folder and files.
DestinationFile = "C:\newfolder\"    ' Define target folder.
 
Shell "cmd /C copy " & SourceFile & " " & DestinationFile & " "


End Sub
0
 

Author Comment

by:ELPANOS
ID: 34959614
Thks for your answer,
i have make the code but nothing is hapen

Private Sub TRANSFERFOTO_Click()
Dim SourceFile, DestinationFile
SourceFile = "\\Panorama-server\data (f)\PHOTOS\Update catalog êùäéêïðïéçóç\*.jpg"    ' Define source folder and files.
DestinationFile = "D:\FOTOCODE\"    ' Define target folder.
 
Shell "cmd /C copy " & SourceFile & " " & DestinationFile & " "
End Sub

Private Sub TRANSFERFOTO_Click()
Dim SourceFile, DestinationFile
SourceFile = "\\Panorama-server\data (f)\PHOTOS\Update catalog êùäéêïðïéçóç\*.jpg"    ' Define source folder and files.
DestinationFile = "D:\FOTOCODE\"    ' Define target folder.
 
Shell "cmd /C copy " & SourceFile & " " & DestinationFile & " "
End Sub

Open in new window

0
 
LVL 77

Accepted Solution

by:
peter57r earned 2000 total points
ID: 34959849
Set a breakpoint at line4 (destinationfile=...) and run the code.
When the code stops, click into the immediate window and  type..
?dir(sourcefile)

If the path is correct then you will see the name of the first file.
Otherwise you will just get a blank line.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:ELPANOS
ID: 34959961
Thks For your help i find finalist this code and is worck, i give you for referance

Private Sub transferfoto_Click()
Dim fso
Dim sfol As String, dfol As String
sfol = "\\Panorama-server\data (f)\PHOTOS\Update catalog" ' change to match the source folder path
dfol = "D:\FOTOCODE" ' change to match the destination folder path
Set fso = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
If Not fso.FolderExists(sfol) Then
    MsgBox sfol & " is not a valid folder/path.", vbInformation, "Invalid Source"
ElseIf Not fso.FolderExists(dfol) Then
    MsgBox dfol & " is not a valid folder/path.", vbInformation, "Invalid Destination"
Else
    
    fso.CopyFile (sfol & "\*.*"), dfol ' Change "\*.*" to "\*.xls" to move Excel Files only
End If
If Err.Number = 53 Then MsgBox "File not found"
End Sub

Open in new window

0
 
LVL 77

Expert Comment

by:peter57r
ID: 34959998
The source path in your 'working' code is not the same as the source path you used in the 'not-working' code you posted earlkier.

0
 

Author Comment

by:ELPANOS
ID: 34960034
Peter i need also progressBar the time is transfer the fotos you can help me?
0
 
LVL 77

Expert Comment

by:peter57r
ID: 34960874
please post a new question so that more people see it.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
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.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

650 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