Solved

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

Posted on 2011-02-23
7
278 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 500 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
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!

 

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

Technology Partners: 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

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.
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.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

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