U
Umar
I am working on a Windows XP environment using MS Office 2007 including
Access 2007. I want to open a document from Access 2007 which I can easily
do with Hyperlink type field. However since all the necessary information is
already in the Database Record I try to avoid creating additional field which
would be a Hyperlink type on the Form unless it is absolutely necessary.
Below is the code that I have to construct the FullFileName which consisted
of ServerName, Division, Unit, RequirementDirectory, FolderName and the
FileName itself. As you can see the Database records has all the necessary
information to construct the FullFileName.
The User is unsophisticated so I cannot expect them to open the document by
doing more than a click or a double-click of the mouse button on the FileName
field on the Form. If this cannot be done then I have to create another
field of Hyperlink type namely DocLink in the Form, as the code and the
comment indicated at the bottom of the code with that the User could click
Me.DocLink and that will open the document that the User need.
' Here is the code
__________________________________________________________________
Option Compare Database
Option Explicit
Private Sub FileName_DblClick(Cancel As Integer)
Dim stServerName, stDivision, stUnit As String
Dim stFullFileName, stReqDir, stFolderName, stFileName As String
Select Case Me.RequirementID
Case Is < 10
stReqDir = "\R000" & Me.RequirementID
Case Is < 100
stReqDir = "\R00" & Me.RequirementID
Case Is < 1000
stReqDir = "\R0" & Me.RequirementID
Case Else
stReqDir = "\R" & Me.RequirementID
End Select
stServerName = "\\MAINSERVER\USERSHARE"
stDivision = "\Division_Requirements"
stUnit = "\Branch_Unit"
stFolderName = "\" & Me.FolderName
stFileName = "\" & Me.FileName
stFullFileName = stServerName & stDivision & stUnit & stReqDir & _
stFolderName & stFileName
'
' After getting the Full File Name, the code to open the document should
go here
' The document or file could be .doc, .xls, .pdf, .txt, etc.
'
' OR
'
' I could create another field named DocLink with type Hyperlink in the Form
' and add the following code, but then the User has to click field DocLink to
' open the file, I try to avoid this additional step.
Me.DocLink = Me.FileName & “#†& stFullFileName & “#â€
End Sub
____________________________________________________________________
Any reply is appreciated.
Thank you,
Umar.
Access 2007. I want to open a document from Access 2007 which I can easily
do with Hyperlink type field. However since all the necessary information is
already in the Database Record I try to avoid creating additional field which
would be a Hyperlink type on the Form unless it is absolutely necessary.
Below is the code that I have to construct the FullFileName which consisted
of ServerName, Division, Unit, RequirementDirectory, FolderName and the
FileName itself. As you can see the Database records has all the necessary
information to construct the FullFileName.
The User is unsophisticated so I cannot expect them to open the document by
doing more than a click or a double-click of the mouse button on the FileName
field on the Form. If this cannot be done then I have to create another
field of Hyperlink type namely DocLink in the Form, as the code and the
comment indicated at the bottom of the code with that the User could click
Me.DocLink and that will open the document that the User need.
' Here is the code
__________________________________________________________________
Option Compare Database
Option Explicit
Private Sub FileName_DblClick(Cancel As Integer)
Dim stServerName, stDivision, stUnit As String
Dim stFullFileName, stReqDir, stFolderName, stFileName As String
Select Case Me.RequirementID
Case Is < 10
stReqDir = "\R000" & Me.RequirementID
Case Is < 100
stReqDir = "\R00" & Me.RequirementID
Case Is < 1000
stReqDir = "\R0" & Me.RequirementID
Case Else
stReqDir = "\R" & Me.RequirementID
End Select
stServerName = "\\MAINSERVER\USERSHARE"
stDivision = "\Division_Requirements"
stUnit = "\Branch_Unit"
stFolderName = "\" & Me.FolderName
stFileName = "\" & Me.FileName
stFullFileName = stServerName & stDivision & stUnit & stReqDir & _
stFolderName & stFileName
'
' After getting the Full File Name, the code to open the document should
go here
' The document or file could be .doc, .xls, .pdf, .txt, etc.
'
' OR
'
' I could create another field named DocLink with type Hyperlink in the Form
' and add the following code, but then the User has to click field DocLink to
' open the file, I try to avoid this additional step.
Me.DocLink = Me.FileName & “#†& stFullFileName & “#â€
End Sub
____________________________________________________________________
Any reply is appreciated.
Thank you,
Umar.