DBL
Registered User.
- Local time
- Today, 13:02
- Joined
- Feb 20, 2002
- Messages
- 659
I have a little pop-up form that shows a list of documents with hyperlinks to the files, filtered to the current record. I switch off the shortcut menus etc so wanted a different way to browse for and get the path to the documents. The form I'm using (thanks Jack) has the following code attached to the browse button:
Private Const EXISTINGFILE As String = "D:\My Documents\My Pictures\*.jpg"
Private Const EXISTINGDIR As String = "D:\MyDocuments\"
Private Sub Command1_Click()
Dim strNewFile As String
On Error GoTo Browse_Err
With Me.cdlgOpen
'You should only use one of the next two lines if you want to open to either a default file or folder
.FileName = EXISTINGFILE 'Comment out if you don't want to open to a default file
'.initdir = ESIXTINGDIR 'Comment out if you don't want to open to a default folder
.CancelError = True
.Filter = "All Files (*.jpg)|*.jpg|" 'Can change (i.e. "Word Files (*.doc)|*.doc|") or ("All Files (*.*)|*.*|") see help for other examples
.ShowOpen ' Can use showSave for saving file, same principle
'strNewFile = .FileName
Me.Image6.Picture = .FileName
Me.Text4 = .FileName
End With
Unfortunately what happens is that when it picks up the file path it stores it in the field as text, regardless of the fact that it's data type in the table is hyperlink. When you click on the file path nothing happens. So, what I need is something so that when I click on the file path in the text/hyperlink field it opens the appropriate document, image etc. We can get it open through a second command button but I want something neater if possible. I'd like to double click the field to get the file path and click to open the file.
Any ideas?
Thanks
Private Const EXISTINGFILE As String = "D:\My Documents\My Pictures\*.jpg"
Private Const EXISTINGDIR As String = "D:\MyDocuments\"
Private Sub Command1_Click()
Dim strNewFile As String
On Error GoTo Browse_Err
With Me.cdlgOpen
'You should only use one of the next two lines if you want to open to either a default file or folder
.FileName = EXISTINGFILE 'Comment out if you don't want to open to a default file
'.initdir = ESIXTINGDIR 'Comment out if you don't want to open to a default folder
.CancelError = True
.Filter = "All Files (*.jpg)|*.jpg|" 'Can change (i.e. "Word Files (*.doc)|*.doc|") or ("All Files (*.*)|*.*|") see help for other examples
.ShowOpen ' Can use showSave for saving file, same principle
'strNewFile = .FileName
Me.Image6.Picture = .FileName
Me.Text4 = .FileName
End With
Unfortunately what happens is that when it picks up the file path it stores it in the field as text, regardless of the fact that it's data type in the table is hyperlink. When you click on the file path nothing happens. So, what I need is something so that when I click on the file path in the text/hyperlink field it opens the appropriate document, image etc. We can get it open through a second command button but I want something neater if possible. I'd like to double click the field to get the file path and click to open the file.
Any ideas?
Thanks