[AccessD] opening a specific file via double click...

Andy Lacey andy at minstersystems.co.uk
Thu Oct 26 01:54:02 CDT 2006


Well you can do what you originally suggested. I assume you have a form
which is displaying the table data. On there put the field with your file
name, create an event procedure for its Double-Click event and in there put:

Call RunApp(Me.ActiveControl,1)

But does the field on the table have the whole path as well as the filename?
RunApp needs the whole lot so that it can find the file.

-- Andy Lacey
http://www.minstersystems.co.uk 

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> Kostas Konstantinidis
> Sent: 26 October 2006 07:04
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] opening a specific file via double click...
> 
> 
> Andy, thank's a lot
> 
> but could you please tell me how to use the
> Call RunApp(stryourfilename,1)
> in order to open the specific file which the name is keeping 
> as data in 
> every record?
> 
> /kostas
> 
> ----- Original Message ----- 
> From: "Andy Lacey" <andy at minstersystems.co.uk>
> To: "Access Developers discussion and problem solving" 
> <accessd at databaseadvisors.com>
> Sent: Wednesday, October 25, 2006 12:29 PM
> Subject: Re: [AccessD] opening a specific file via double click...
> 
> 
> > Hi Kostas, this is what I use.
> >
> > Create a module and paste this in
> > '''''''''''''''
> > Declare Function ShellExecute Lib "shell32" Alias "ShellExecuteA" 
> > (ByVal hWnd As Long, _ ByVal lpOperation As String, ByVal lpFile As 
> > String, ByVal lpParameters As String, _
> > ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
> >
> >
> > Private Const InadequateMemory = 0
> > Private Const FileNotFound = 2
> > Private Const PathNotFound = 3
> > Private Const BadFormat = 11
> > Private Const NotRegistered = 31
> > Private Const Success = 32
> > Private Const BIF_RETURNONLYFSDIRS = &H1
> > Public Const sizeNormal = 1
> > Public Const sizeMinimize = 2
> > Public Const sizeMaximize = 3
> >
> > Function RunApp(strFile As String, bytSize) As Boolean
> > Dim lngRet As Long
> > Dim varTaskID As Variant
> > Dim strRet As String
> >
> > lngRet = ShellExecute(hWndAccessApp, vbNullString, strFile, 
> > vbNullString, vbNullString, bytSize) If lngRet > Success Then
> > strRet = vbNullString
> > lngRet = -1
> > RunApp = True
> > Else
> > RunApp = False
> > Select Case lngRet
> > Case NotRegistered
> > varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL " 
> & strFile,
> > bytSize)
> > lngRet = (varTaskID <> 0)
> > Case InadequateMemory
> > MsgBox "Error:  Out of Memory/Resources!"
> > Case FileNotFound
> > MsgBox "Error:  File not found!"
> > Case PathNotFound
> > MsgBox "Error:  Path not found!"
> > Case BadFormat
> > MsgBox "Error:  Bad File Format!"
> > Case 5
> > MsgBox "Error:  Unauthorized due to Security restrictions!"
> > End Select
> > End If
> > End Function
> >
> > '''''''''''''''
> >
> > You can then open any registered file type with the following:
> >
> > Call RunApp(stryourfilename,1)
> >
> > HTH
> >
> > --
> > Andy Lacey
> > http://www.minstersystems.co.uk
> >
> >
> >
> >
> > --------- Original Message --------
> > From: "Access Developers discussion and problem solving" 
> > <accessd at databaseadvisors.com>
> > To: "Access Developers discussion and problem solving" 
> > <accessd at databaseadvisors.com>
> > Subject: [AccessD] opening a specific file via double click...
> > Date: 25/10/06 07:51
> >
> >
> > dear group for one more time i need your help
> > I have a text field in which the stored data are just names 
> of files 
> > (e.g. aaa.pdf) Is that possible by double click on the 
> specific field 
> > to load the file with the same name as well?
> >
> > thank's a lot
> > /kostas





More information about the AccessD mailing list