Hyperlink to a directory (1 Viewer)

msp

Registered User.
Local time
Today, 01:51
Joined
Apr 5, 2004
Messages
155
Hi,

I am trying to create a hyperlink to a directory and so that users can select the file they want to open. I saw this link below Hyperlink database which seemed exactly what I wanted. However when ever I try the sample database I get the error "There is No object in this control". I have tried this with access 2000 on Windows 2000 and access 2003 on windows XP. Does anyone know if I need any additional software installed (or Licensed) to utilise the CommonDialog control.

However if anyone has any other suggestions as to how I could hyperlink to a directory they would be very much appreciated.

Thanks in advance
 
Last edited:

___

¯¯¯¯¯
Local time
Today, 01:51
Joined
Nov 27, 2003
Messages
595
Not sure if this is what you are looking for, but you could try it. Create a new table called tblFileNames with one memo column called File. In the OnClick event of a button put the following code...
Code:
DoCmd.SetWarnings False

DoCmd.RunSQL "DELETE tblFileNames.File FROM tblFileNames;"
Set rstFiles = CurrentDb.OpenRecordset("tblFileNames", dbOpenDynaset)
    With Application.FileSearch
        .NewSearch
        .LookIn = "C:\"
        .SearchSubFolders = True
        .FileName = ""
        .FileType = msoFileTypeAllFiles
        .MatchAllWordForms = True
            If .Execute() > 0 Then
                For i = 1 To .FoundFiles.Count
                        rstFiles.AddNew
                        rstFiles("File") = .FoundFiles(i)
                        rstFiles.Update
                Next i
            Else
                MsgBox "No files found."
            End If
    End With

rstFiles.Close

DoCmd.SetWarnings True
Change "C:\" to the folder that needs to be searched.
HTH
 

msp

Registered User.
Local time
Today, 01:51
Joined
Apr 5, 2004
Messages
155
___ said:
Not sure if this is what you are looking for, but you could try it. Create a new table called tblFileNames with one memo column called File. In the OnClick event of a button put the following code...
Code:
DoCmd.SetWarnings False

DoCmd.RunSQL "DELETE tblFileNames.File FROM tblFileNames;"
Set rstFiles = CurrentDb.OpenRecordset("tblFileNames", dbOpenDynaset)
    With Application.FileSearch
        .NewSearch
        .LookIn = "C:\"
        .SearchSubFolders = True
        .FileName = ""
        .FileType = msoFileTypeAllFiles
        .MatchAllWordForms = True
            If .Execute() > 0 Then
                For i = 1 To .FoundFiles.Count
                        rstFiles.AddNew
                        rstFiles("File") = .FoundFiles(i)
                        rstFiles.Update
                Next i
            Else
                MsgBox "No files found."
            End If
    End With

rstFiles.Close

DoCmd.SetWarnings True
Change "C:\" to the folder that needs to be searched.
HTH

HI __,

Will this allow me to open files within this directory.

What I am attempting to do is click on a button in my DB this will open the windows explorer box and allow the user to open documents in that directory.
 

___

¯¯¯¯¯
Local time
Today, 01:51
Joined
Nov 27, 2003
Messages
595
Ahhh, I misunderstood what you need. Do a search on 'Common Dialog' and I think you'll find what you need.
HTH
 

ghudson

Registered User.
Local time
Yesterday, 20:51
Joined
Jun 8, 2002
Messages
6,195
msp said:
What I am attempting to do is click on a button in my DB this will open the windows explorer box and allow the user to open documents in that directory.
You have a few choices to make depending on how you want to do this. Do you want to open a session of Windows Explorer directly to a specific folder or do you want to call the Windows "File Open" dialog box?

This will open a new session of Windows Explorer to the C:Windows\Temp\ folder...
Code:
Call Shell("C:\Windows\Explorer.exe C:\Windows\Temp", vbMaximizedFocus)

Check out these APIs for calling the standard windows "File Open" and "Browse Folder" using VBA...

API: Call the standard Windows File Open/Save dialog box
http://www.mvps.org/access/api/api0001.htm

API: BrowseFolder Dialog
http://www.mvps.org/access/api/api0002.htm

Those APIs do not require your db to use any ActiveX or assign any references to your db.

HTH
 

msp

Registered User.
Local time
Today, 01:51
Joined
Apr 5, 2004
Messages
155
Great thanks guys, I managed to get it to work with your help... Finally lets just hope my boss is happy with what he wanted...
 

Debased

Registered User.
Local time
Yesterday, 17:51
Joined
Mar 11, 2004
Messages
112
Thanks Ghudson!!

Man that link is excellent! I have had several occasions where I needed to use that Browse function and never knew how until now. It works great!
thanks a bunch!! :D :D :D
 

ghudson

Registered User.
Local time
Yesterday, 20:51
Joined
Jun 8, 2002
Messages
6,195
Debased said:
Man that link is excellent! I have had several occasions where I needed to use that Browse function and never knew how until now. It works great!
thanks a bunch!! :D :D :D
Your welcome! I prefer to use VBA when ever possible and those APIs are the two of the most common questions asked which is probably why that site listed those links 1st and 2nd in the API section.
 

Users who are viewing this thread

Top Bottom