By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 801 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

find file, copy and save under new name?

P: n/a
looking for an easy way for users to browse for a file on their local
drive, and then have access automatically make a copy of that file
(files will most likely be images) and save it under a new name
(somehow relating it to the PK of the main table) in a directory on
the server where the DB is stored...

i realize that might not be the best wording of what im trying to do,
so ill try explaining it a lil differently. each record created in the
db will have an image or drawing associated with it, but any way of
storing it within the DB is too space intensive. so i want the user to
create the image, save it locally, then browse for it within access,
and use that path name to let access make its own server side copy so
i can later use it when printing reports. i will have the DB look for
the related image when printing the standard report, so if printing
record 34, it should insert "34.jpg" into the report. for now, im just
trying to get the image copied.

using access 2002, very limited vb knowledge, but willing to try
anything.

thanks
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 1 Jul 2004 11:03:34 -0700, ch******@umbc.edu (Greg) wrote:
looking for an easy way for users to browse for a file on their local
drive, and then have access automatically make a copy of that file
(files will most likely be images) and save it under a new name
(somehow relating it to the PK of the main table) in a directory on
the server where the DB is stored...

i realize that might not be the best wording of what im trying to do,
so ill try explaining it a lil differently. each record created in the
db will have an image or drawing associated with it, but any way of
storing it within the DB is too space intensive. so i want the user to
create the image, save it locally, then browse for it within access,
and use that path name to let access make its own server side copy so
i can later use it when printing reports. i will have the DB look for
the related image when printing the standard report, so if printing
record 34, it should insert "34.jpg" into the report. for now, im just
trying to get the image copied.

using access 2002, very limited vb knowledge, but willing to try
anything.

thanks


First get the API code to use the Windows Common file dialog from...

http://www.mvps.org/access/api/api0001.htm

This will allow the user to search for the file (jpg) and return the
path to it.

Then you would use FileCopy to copy the file to the destination on the
server. Rename the file to match the PK.

FileCopy "path returned by file dialog", "path to server folder" _
& Me.PK & ".jpg"

That should do it. Post back if you have any questions.

- Jim


Nov 13 '05 #2

P: n/a
ch******@umbc.edu (Greg) wrote in message news:<f2**************************@posting.google. com>...
1. browse for a file on their local drive,
2. then make a copy of that file
3. and save it under a new name (somehow relating it to the PK of the
main table) in a directory on the server where the DB is stored...
for now, im just trying to get the image copied.


1. Use OpenFile dialog from here to get the name/path of the file:
"Call the standard Windows File Open/Save dialog box"
http://www.mvps.org/access/api/api0001.htm

2. make a copy of the file and save it under a new name.
Public Sub CopyFile(ByVal strSourceFile As String, strDestinationFile
As String)
FileCopy SourceFile, DestinationFile ' Copy source to target.
End Sub

3. Oh, and it has to have a name from the DB... OK...
rs.Fields("FileName")

FileCopy "C:\MyFolder\MyJPEG.jpg"
"\\MyServer\Path\MyFolder\MyJPEG43.jpg"

(just use strings to build the final path... nothing doing.
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.