Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening file resource from form?

Status
Not open for further replies.

HighLife

Programmer
Jun 17, 2003
12
AU
Is it possible to launch a database file resource from a form - if so how?

I have a .pdf document in my database as a file resource. I want to have a button on a form that will open the .pdf in acrobat reader.

I am thinking this might be possible with:

@Command([Execute];"Acrobat.exe";"?");

But as you can see, I am not sure how to reference the file resource?

Any suggestion on how to complete this or a better way to do it?
 
If you say file resource, I imagine that the file is stored in a different document.
In that case, I suggest building a FileLookup view and a FileLookup form. In the view, list all documents that have an attachment. You will need to devise a key for listing them, and the first column needs to be sorted.
In the views Form Formula, set the name of the FileLookup form.
That form needs two things :
1) a rich text field (named Body if you follow the standards defined by Lotus) that is named the same as the one used to store attachments in the forms that appear in the view
2) the Form Properties need to have the "Autolaunch - first attachment" option activated (3rd tab)

When all that is done, all your code needs to do is get the document via the view and open it.
Given that the form used launches the first attachment, your OS should automatically open a PDF file in Acrobat, and XLS in Excel, etc..
Of course, these apps must be installed for the feature to work.

Pascal.
 
If you are trying to write a formula for a button that will launch a file when clicked then do the following.

If Acrobat.exe was located on your system in C:\Acroread\Reader you would use the following in your formula:

@Command([Execute];"C:\\Acroread\\Reader\\Acrobat.exe").

This also works for mapped drives. So if you had a file that you want to launch on a shared drive just use the shared drive letter.

Make sure you use the double slashes otherwise the formula will not work.

Hope this helps
 
..thanks guys.

Yeah I wanted an action button to open the pdf for printing. I ended up placing the file on a mapped network share and used the @Command([Execute]) to open it - works fine after I worked out the double slash thing!

Now I'm thinking I might place the path to the file on a profile document and reference it with @GetProfileField, so it will be easy to update the path to the file if its required.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top