[AccessD] Pick a file, any file

Stuart McLachlan stuart at lexacorp.com.pg
Fri Jun 5 19:18:06 CDT 2009


You don't have to make it a hyperlink.  A simple text string will do.

If you have a text box txtDocName containig a simple string on a form, 
putting "Application.FollowHyperlink txtDocName" in 
the text box's Double_Click event will do it.

I'm working on an application at the moment where I store photos in subdirectories below 
the BE directory (one directory per "property") and store the simple file name in a field 
named Photo.  

On one form, txtPhoto_DblClick() opens an OpenFileDialog in the appropriate sub directory 
so that the user can pick a specific photo. The name of the selected image file in then 
displayed in txtPhoto.

On another form, the following opens the photo in the default viewer (in my case IrfanView).

Private Sub txtPhoto_DblClick(Cancel As Integer)
   Application.FollowHyperlink  BEDir() & "\Photos\" & _
  Trim$(Str$(PropertyNumber)) & "\" & txtPhoto
End Sub



On 5 Jun 2009 at 14:51, Rocky Smolin wrote:

> Just discovered it by Googling. 
> 
> But you gotta make the text by a hyperlink.  Which is actually nice
> esthetically because it's blue, underlined, and the cursor changes to a
> pointy finger when you hover over the hyperlink.  I set it to trigger on a
> double-click.
> 
> Rocky
>  
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
> Sent: Friday, June 05, 2009 2:20 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Pick a file, any file
> 
> Darn it!  How long's that been around.
> 
> I've always used a call to ShellExecute() when I needed to do this. :-(
> 
> FollowHyperlink is much simpler.
> 
> 
> --
> Stuart 
> 
> On 5 Jun 2009 at 13:47, Rocky Smolin wrote:
> 
> > OK, never mind, I found it - Application.FollowHyperlink seems to do it.
> > Too easy.
> > 
> > Rocky
> >  
> > 
> > -----Original Message-----
> > From: accessd-bounces at databaseadvisors.com
> > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky 
> > Smolin
> > Sent: Friday, June 05, 2009 1:42 PM
> > To: 'Access Developers discussion and problem solving'
> > Subject: [AccessD] Pick a file, any file
> > 
> > Dear List:
> > 
> > I have a client who wants a list of file attachments as children to a 
> > parent table.  No problem.  I get the path and file names  using the 
> > open file dialog box.
> > 
> > But now he wants to be able to click the attachment text box (it 
> > contains path and file name), and open the file with whatever program 
> > should open it
> > - .doc/.docx with word, .pdf with acrobat, .xls with Excel, .jpg with 
> > whatever he's go it associated with, and any other file regardless of 
> > extension (based perhaps on the association?).
> > 
> > Is there a way to general case this without knowing what application 
> > should be used to open the attachment and exactly where the application is
> located?
> > 
> > MTIA
> > 
> >  
> > 
> > Rocky Smolin
> > 
> > Beach Access Software
> > 
> > 858-259-4334
> > 
> > www.e-z-mrp.com <http://www.e-z-mrp.com/>
> > 
> > www.bchacc.com <http://www.bchacc.com/>
> > 
> >  
> > 
> >  
> > 
> > 
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> 
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com





More information about the AccessD mailing list