upload file into BE folder

A

Aaron

Couldn't find this one anywhere....

For some records, users will have excel files on their local drive that are
related to that record.
When someone inputs and posts details for a particular record, I would like
to give them the option to upload their excel file to the shared drive that
the BE is on. Therefore, another user viewing the details of that record can
click a command button to open and view that excel file.
It needs to remain an excel file since it is not in a database-ready format.


Any thoughts? Is this possible through Access?

If it is possible, how could you create a command button to open the excel
file that is related to that particular record.

Does this go outside of the scope of Access since you need to assign some
identifier-link between the excel filename and the Access record?

Thanks in advance.
 
A

Albert D.Kallal

Well, I see no difficulty in you defining a "path", or "location" field or
even a single "configuration" record in your database that contains the path
names to folders.

To launch word, Excel, pdf, or any windows application, you can go:


application.FollowHyperlink "path name to your file"

The above would launch the document as if you clicked on it (so, you can
store path names to pdf, or Excel, or whatever).

As far as the location to the BE file? Well, I always write a function that
"grabs" the back end path name.

So, to launch a document in a folder called "ExcelStuffFolder" in the back
end, you could go:

strDocName = strBackEndPath & "ExcelStuffFolder\" & me!ExcelDoc

application.FollowHyperlink strDocName

The above assumes we got a field in the current reocrd called ExcelDoc
(might be cust235.xls for example).

So, I would store the document name in a field in the table, but KEEP the
path names separate (that way, you can simply modify the path name, and not
have to modify the document name - this would allow you to move the system
to a different setup, or change the folders where the documents reside).

And, you can use the "filecopy" command in ms-access to copy any windows
file...

The function "strBackEndPath" is reproduced below, and simply returns the
location of the back end database. The above exmaple would simply use a
folder called ExcelStufFolder that is "relative" to the back end location.

And, of course you likely also have a function to return the path name of
the front end. You can use

currentproject.Path

so,

stDoc = "budjet.xls"

filecopy currentproject.path & stDoc,strBackEndPath & "ExcelFolder\" & stDoc

The above would copy a excel document from the current front end dir to the
back end folder as above...


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
[email protected]
http://www.members.shaw.ca/AlbertKallal


Function strBackEndPath() As String

Dim mytables As TableDef

Dim strTempBack As String
Dim strFullPath As String
strFullPath = ""

For Each mytables In CurrentDb.TableDefs
If Left(mytables.Connect, 10) = ";DATABASE=" Then
strFullPath = Mid(mytables.Connect, 11)
Exit For
End If
Next mytables

strBackEndPath = Left(strFullPath, InStrRev(strFullPath, "\"))

End Function
 
Top