File directories

tezread

Registered User.
Local time
Today, 05:28
Joined
Jan 26, 2010
Messages
330
This question has probably been asked before and In have done some searches but not found anything yet.

I am trying to show hyperlinks to PDFs and word docs for database records - any signposting guys on how this has been done in the past?
 
Store the path and file name in a field in your table. Use the Applicaiton.FollowHyperlink command in a form to allow the user to open the file based on the path file name value if you want to give the user that feature.
 
Store the path and file name in a field in your table. Use the Applicaiton.FollowHyperlink command in a form to allow the user to open the file based on the path file name value if you want to give the user that feature.

This woild require the user to copy/paste the file directory from the file properties to a field in a table yes? If the file directory is constant and ther filename is the only thing that changes - is there not a more efficient way of doing this.

Just to clarify on what i am trying to do - I have patient records and for each record there is correspondence - when I open up the record I want to be able to see the document open up as well
 
Shift open the attached Database and open the frmChangeRequests form in design view. Look at the code I use behind the 'Add Attachment' button.

Basically, it opens up the browser window to allow the user to navigate to the directory where the file to be attached is currently held. When they click open, a copy of the original file is then copied into a folder on a shared network drive (so that others have access to open the file from the Database) and then the hyperlink is set to equal the new directory for the attachment.
 

Attachments

Shift open the attached Database and open the frmChangeRequests form in design view. Look at the code I use behind the 'Add Attachment' button.

Basically, it opens up the browser window to allow the user to navigate to the directory where the file to be attached is currently held. When they click open, a copy of the original file is then copied into a folder on a shared network drive (so that others have access to open the file from the Database) and then the hyperlink is set to equal the new directory for the attachment.


thanks dbdamo - do you have a version of this db that isn't locked as I can't get in the backend of it when pressing f11
 
Like I said, hold down shift when opening the Database. This is a sample DB and so isn't split into FE/BE -all tables, queries, forms etc are in the one file
 
If you want the user to be able to browse and find the file that you want to store the location path and file name in a record then check out my old Browse [Find a directory or file] sample for an idea on how to do it.
 
I haven't looked at your sample ghudson, but do you create a copy of the original file on a shared network drive?

If not, how does it cope when a file is attached from a users C:\ drive and another user attempts to view the attachment by clicking the hyperlink?
 
So if a user were to attach a file from their hard drive, or a location that is not shared, nobody other than them would be able to follow the hyperlink and open the attachment?
 
that is correct. you need to have the file saved in a location that all user have access too. you can automate the saving of a file and/or copying a selected file to a specific location. search the forum for I believe there are samples or code for copying files.
 
Thats exactly what my sample does, takes a copy of the original file and places it on a shared network drive then uses the new directory as the hyperlink. I was just wondering if yours did the same, and if so if it did so in a more efficient way.
 
Thats exactly what my sample does, takes a copy of the original file and places it on a shared network drive then uses the new directory as the hyperlink. I was just wondering if yours did the same, and if so if it did so in a more efficient way.


does your sample capture the file path and put that into a field named 'filepath'.
 
It takes the new filepath and puts it into the first available attachment field which in my sample is either Attachment1, Attachment2 or Attachment3.

Obviously you would need to amend the code in my sample to suit your structure.
 
My sample does not copy a file.

Hi ghudons

I have tried out the browsing sample - I know when I use ffindopenimportfile form I and click 'Import ' I get an error message:

error 2091 field F1 doesn't exist in destination table tblimport

How is the database capturing a filepath, and storing it so it can be recovered

If you can imagine the scenario - I have a patient that is discussed in a meeting - each patient has a PDF document describing their background and I want to see a link to that document in each patient record
 
You need to look at the process and code used to get the file information in the fScanDirSelectFileFromTable form to learn how to get the path and file info
 
I am not not advanced with VBA really but I can now see how to change where the default files directory is in your code and how the table tfiles is populated. I have changed the directory now and added a field in tfiles table PatientID.

I have added fscanDirSelectFromFileTable as a subform in my patients form.

Where I am stuck is how to have files list that relate only to that patient
 

Users who are viewing this thread

Back
Top Bottom