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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display a Non-Access File from Access 3

Status
Not open for further replies.

Dummy99

Programmer
Apr 25, 2002
30
0
0
FR
While in a form, at the users's request, e.g., clicking a button or double clicking a control, I need to display the contents of a file (just for reading/viewing, such as a PDF, JPG, DOC, etc., in a sub form or whichever way possible.

Can anyone help please?

Thank you.
Dummy99
 
Yes...set the HYPERLINK property of a button to something like

C:\Documents\filename.doc

and clicking on the button will make the document open in MS Word.

The associations in Windows will open the correct application (i.e. Word, Excel, Adobe, etc.).

It's easy!

Good luck.

Jim "Get it right the first time, that's the main thing..." [wavey]
 
To expound upon Jim's idea...

Just use this code on the OnClick of your button to set the hyperlink every time the button is clicked (for different files)

Private Sub ButtonName_Click()
ButtonName.HyperlinkAddress = Text0
End Sub Kyle [pc2]
 
Thanks guys,

Really helpful and as you said easy - but then everything's easy once you know it, yes/no?

One more little associated problem you might help me with.

When the foreign file gets opened, the "WEB" toolbar is displayed. Can I prevent this? I've taken care of when the user returns to Access - after issuing the
ButtonName.HyperlinkAddress = path&filename
I issue
Forms!my-for-mname.Toolbar = ""
and that eliminates the "WEB" toolbar in Access. But if possible, I would like to remove it in the display of the foreign file.

Thanks,
Michael
 
I don't know of a way to do that. It's annoying, isn't it?

I guess because it's a hyperlink the Word assumes the web is being accessed.

Sorry.

Jim "Get it right the first time, that's the main thing..." [wavey]
 
Hi Jdegeorge,

Yes very annoying, particularly when a solution works at night and doesn't work in the morning or it works on my PC (connected to server and net) at the office but doesn't work on my stand-alone laptop at home.

This morning, I expanded on my solution and it now works beautifully on my PC - I now don't get the Web toolbar when the foreign file is opened and I don't get it in the Access either. Here is the solution I found - I'm not sure all of the code is necessary (there are peculiarities and so it needs more testing) but so far it works even if it's too much code.

ChangeProperty "AllowBuiltinToolbars", dbBoolean, False

Forms!my-form-name.my-button-name.HyperlinkAddress = "my-path-and-filename"

ChangeProperty "AllowBuiltinToolbars", dbBoolean, False

Forms!my-form-name.Toolbar = ""

Enjoy it! No more annyoance - so far.
Michael
 
Michael:

I'll give it a whirl on my next application that needs this functionality.

Nice work around!

Jim "Get it right the first time, that's the main thing..." [wavey]
 
Thanks for that suggestion Michael! The stupid "You must need the web toolbar now!" response from Access is so irritating that even Access gurus FMS avoid hyperlinks to prevent it.

This allow built-in toolbars property can be set globally from the Start Up dialogue as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top