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

Andy Lacey andy at minstersystems.co.uk
Wed Oct 25 04:29:46 CDT 2006


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


----- Original Message -----
From: <paul.hartland at fsmail.net>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Tuesday, October 24, 2006 5:06 PM
Subject: Re: [AccessD] A2003:Rename a file in a folder


> Darren,
>
> Off the tope of my head use the following:
>
> Dim strFile As String
>
> strFile = Dir(myCoolCSVfile.csv, vbHidden) ' Put the full path before the
> filename
> If (strFile<>"" ) then
> Name myCoolCSVfile.csv As YYMMDDHHMMSS.csv ' Put the full path
> before the filename and new file name
> Endif
>
> ' Your routine to put the new file into C:MyCoolFolder
>
> Paul Hartland
>
>
>
> Message Received: Oct 24 2006, 02:58 PM
> From: "Darren DICK"
> To: "'Access Developers discussion and problem solving'"
> Cc:
> Subject: [AccessD] A2003:Rename a file in a folder
>
> Hi all
>
> I have a file that will be always named the same - EG myCoolCSVfile.csv
>
> It will be dumped into a folder...say C:MyCoolFolder at random times
>
> I need some code to Check the C:myCoolFolder to see if the file
> myCoolCSVfile.csv file exists in the folder - and if it does to rename it
> to
> YYMMDDHHMMSS.csv
>
> Where YY = Year MM = Month DD = Day etc etc
>
> Does anyone have anything that might suit?
>
> Many thanks in advance
>
> Darren
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
>
>
>
> Paul Hartland
> paul.hartland at fsmail.net
> 07730 523179
> --
> 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

________________________________________________
Message sent using UebiMiau 2.7.2




More information about the AccessD mailing list