473,387 Members | 3,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

find file, copy and save under new name?

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
2 9325
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: DanB | last post by:
This is probably soooo simple but I can't seem to get it. I have a text file that I want users to download via a web page. I want the file to be saved to a default folder (or one that they...
0
by: Xah Lee | last post by:
Interactive Find and Replace String Patterns on Multiple Files Xah Lee, 2006-06 Suppose you need to do find and replace of a string pattern, for all files in a directory. However, you do not...
5
by: peter | last post by:
Hello all, I'm looking for an advice. Example (one block in ascii file): $------------------------ NAME='ALFA' CODE='x' $------------------------
3
by: tshad | last post by:
I have a function that downloads a file to the users computer and it works fine. The problem is that I then want the program to rename the file (file.move) to the same name plus todays date. ...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
1
by: qiong | last post by:
Dear friends, Good evening, I have some problems with finding keyword ":\" for each cell. My objective is to find that keyword in each cell in each worksheet which represent the link. Eg:...
22
by: clicwar | last post by:
A simple program with operator overloading and copy constructor: #include <iostream> #include <string> using namespace std; class Vector { private: float x,y; public: Vector(float u, float...
6
by: Milan Krejci | last post by:
while(list($key,$value) = each($_FILES)) { if(!empty($value)){ $filename = $value; $add = "upimg/$filename"; echo $_FILES; $error=copy($_FILES, $add); if (!$error)...
4
by: David | last post by:
Hi I'm using this code to import data from an excel spreadsheet: DoCmd.TransferSpreadsheet , acSpreadsheetTypeExcel9, "tblStudents", _ "\\Egusersrv\Staff - Shared Work\PE Teach &...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.