Moving Files

I

IT-1957

Good morning all:

I have this project where I have to take a picture of every order sent to
the customer. I have a database that track these Orders, the user scan the
order and the system mark it as completed. Now, The idea is to have a form
that promps the user to take the picture, (I have set uo a webcam that does
this,and create a floder on where these pictures are going to be stored, the
picture is taken by clicking a button on the camera, this places the pictures
on the specified directory)

I have this code:

Function Test()

Dim SourceFile, DestinationFile
SourceFile = "C:\Documents and
Settings\TR392\Desktop\APS_Picture_Project\WebCam\Picture 17.jpg" ' Define
source file name."
DestinationFile = "C:\Documents and
Settings\TR392\Desktop\APS_Picture_Project\Database\Test.jpg" ' Define
target file name."
FileCopy SourceFile, DestinationFile ' Copy source to target.

End Function

This code copy the Picture 17.jpg and save it as Test.jpg
The problem is that the webcam software names the next picture (i can not
change thhis) Picture 18.jpg , 19 , 20 etc...
How can I write the code so it takes any file name as the source? (and
prefereably to move or cut the file for the source to the destination?)
I also need to name the new file as one of the controls on my form(the order
id)

I'm adding a field with the path to this picture for future reference with
each Order.

Thank you for your help. I really appreciate it.
 
I

IT-1957

Thank you "egerds"
This cut and paste the file to the new location (perfect)
How can I cut any ".jpg" file independently of its name? or any new file
placed on that directory?
As I mentioned earlier, the webcam will place a file as picture1.jpg the
next one will be picture2.jpg then picture3.jpg etc
The code only works with the specific name set on it.

Thanks again for your help.
 
I

IT-1957

OK, I been trying to get this to work but I just can't find a solution, I was
able to get the webcam to always name the picture the same but now when the
file is in its new location, how can I change its name to be same as what is
showing on one of my controls?
This is my failed attemp, (note that I'm really new coding)

Function test()

Dim SourceFile, DestinationFile
Dim NewFileName As String
NewFileName = Form_Form1.Text0 & ".jpg"
SourceFile = "C:\Documents and
Settings\TR392\Desktop\APS_Picture_Project\WebCam\Picture 47.jpg"

'= Dir(C:\Documents and
Settings\TR392\Desktop\APS_Picture_Project\WebCam\*.jpg)
DestinationFile = "C:\Documents and
Settings\TR392\Desktop\APS_Picture_Project\Database\NewFileName"
Name SourceFile As DestinationFile

End Function

Thank you for your help.
 
I

IT-1957

After trying a few times, I got it working, I hope It can help some one else
as well
Here it is the final code:

Function test()

Dim SourceFile, DestinationFile

SourceFile = "C:\Documents and
Settings\TR392\Desktop\APS_Picture_Project\WebCam\Picture 47.jpg"
DestinationFile = "C:\Documents and
Settings\TR392\Desktop\APS_Picture_Project\Database\" & Form_Form1.Text0 &
".jpg"
Name SourceFile As DestinationFile

End Function

THANK YOU.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top