• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

Need code to Open a BROWSER and view an HTML file

Hello!

I have a query that displays a column called description that includes html text.
Is there a way that I can view the code using a browser by clicking on the specific cell that I want to view?

I read an older message board posting from one user who said there is a way to do this using an OLE Object type of table cell.  I've also wondered whether I might use the hyperlink cell type.

If this is not possible, I have already written code to save a file on the disk at C:\mytempfolder\exportfile.html and can get by if I get code to open the file with a browser.

Your help is always appreciated

'm using MS Access 2000, XP Pro
0
pcalabria
Asked:
pcalabria
  • 2
  • 2
1 Solution
 
PatHartmanCommented:
I don't use the hyperlink data type, mostly because it isn't supported by SQL Server.  I just use a text data type and set the FormatAsHyperlink property to always.  Then in the click or dbl-click event, use the FollowHyperlink Method to open the document.  This will open whatever app is set as the Windows default for this particular file extension.  If the default doesn't work for you, you can use Shell but you will need to know what application you want to open and where it is so this method can cause issues if your users don't have consistent software and install locations.  So start with the FollowHyperlink because it relies on defaults.
0
 
pcalabriaAuthor Commented:
Perhaps you can explain a bit further...

I currently have a column called Description in a query that contains HTLM code.

Is FormatAsHyperlink a property of the query?  If so, where is it and is it supported in Access 2k?

Also, what do mean by FollowAsHyprelink method?  I've used that before to link to urls, will it work for a file on my hard drive?
0
 
PatHartmanCommented:
You can't do any of this in the query.  You need to open a form bound to the query because we are talking about properties of controls on a form and code that you execute in events and none of those apply to queries.

The FollowHyperlink method works for any file type as long as it is registered with Windows so Windows knows what program is defined as the default for when you double-click on a file of that type.  So, if you double-click on a file and some app opens up the document, then FollowHyperlink will work.  If Windows asks you what program you want to use, then FollowHyperlink will not work.  To make it work, you need to create a new association.  For example, you can associate notepad with file extension = .abc.  Then if you double-click on myfile.abc, Notepad is launched and will try to open the specified file.  I use FollowHyperlink all the time to open documents that my users "attach" to an audit.  This method frees me from having to use Shell where I would have to know the path to the executable.  So, if I wanted to open a .doc file using Shell, I would need the path to the MSWord.exe file and that means I would also need to know the version since versions are typically loaded into different folders.
0
 
pcalabriaAuthor Commented:
Thanks!  Works great!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now