Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to browse Windows Explorer from MS Access? 1

Status
Not open for further replies.

pelletier

Technical User
May 17, 2001
4
CA
I'm looking for a way to "call" Windows Explorer from within MS Access. I know I could insert a hyperlink to get to a particular file but I want to launch Windows Explorer and have it start by highlighting a particular file instead. For example, user would click something and Windows Explorer would open and C:\Windows\Folder\file.txt would be highlighted. Any ideas? Would a macro or a RunCommand work and if so could you provide an example. Thanks.
 
Perhaps you'd be kind enough to provide a working example.

Bob
 
pelletier,

Could you explain what you want to accomplish? It sounds like you will open a dialog in Access, browse for a file, click on the file and have Windows Explorer open. What's the point? You just did in Access what you can do in Explorer.

Just trying to understand your requirement! :) Terry

;-) The single biggest challenge to learning SQL programming is unlearning procedural programming. -Joe Celko

SQL Article links:
 
The purpose of this is two-fold. 1 - to have Windows Explorer launched from within Access rather than users having to launch it separately. 2 - to have the location of the file specified for the user, rather than the user have to search our network folders and drill thru many layers. My example wasn't as helpful as it might have been. A better file name would be: N:\Workgroups\Business Unit\Forms\Client\file.txt This would provide a starting point within Windows Explorer for them. If the actual file they needed to access was N:\Workgroups\Business Unit\Forms\Client\another.txt, they would be able to see this... Thanks very much
 
Hi!

Of course!
Write your e-mail address and I'll send to you any solution of this problem.

Aivars
 
Hello Aivars, here is my e-mail address: pellet1ier@netscape.net Thanks again..
 
Hallo again!

I'll send sample DB to you Morning because presently is late (almost 9 PM) and I need to make some changes in the form because this form is part of big application and it have some relations to DB variables and other forms.

Aivars
 
Hallo again!

I'll send sample DB to you Monday because presently is late (almost 9 PM) and I need to make some changes in the form because this form is part of big application and it have some relations to DB variables and other forms.

Aivars
 
Hi!

Write hour e-mail address correct if you need any help. I tried to send you sample DB two times to e-mail addresses:

pellet1ier@netscape.net
pelletier@netscape.net

These addresses had permanent fatal errors

Aivars
 
I prefer to use a Windows API call rather than the control because when I distribute the application to various users, if they don't have the correct version of the control the application blows up.

Private Type BrowseInfo
hwndOwner As Long
pIDLRoot As Long
pszDisplayName As Long
lpszTitle As Long
ulFlags As Long
lpfnCallback As Long
lParam As Long
iImage As Long
End Type

'Browsing for directory.
Private Const BIF_RETURNONLYFSDIRS = &H1 'For finding a folder to
'start document searching
Private Const BIF_DONTGOBELOWDOMAIN = &H2 'For starting the Find
'Computer
Private Const BIF_STATUSTEXT = &H4
Private Const BIF_RETURNFSANCESTORS = &H8

Private Const BIF_BROWSEFORCOMPUTER = &H1000 'Browsing for Computers.
Private Const BIF_BROWSEFORPRINTER = &H2000 'Browsing for Printers
Private Const BIF_BROWSEINCLUDEFILES = &H4000 'Browsing for Everything

Private Const MAX_PATH = 260

Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
Private Declare Function lstrcat Lib "KERNEL32" Alias "lstrcatA" (ByVal _
lpString1 As String, ByVal lpString2 As String) As Long

Private Declare Function SHBrowseForFolder Lib "shell32" (lpbi As _
BrowseInfo) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList _
As Long, ByVal lpBuffer As String) As Long

Dim OpenFile As OPENFILENAME
Dim lngReturn As Long
Dim strFilter As String
Dim strFilename As String

Me.cboSelector = Null
With OpenFile
.lStructSize = Len(OpenFile)
.hwndOwner = Me.hWnd
.hInstance = Application.hWndAccessApp
strFilter = "DMATS data (Data*.mdb;Data*.mde)" _
& Chr(0) & "data*.mdb" _
& Chr(0) & "data*.mde" & Chr(0) & Chr(0)
.lpstrFile = String(257, 0)
.lpstrFilter = strFilter
.nFilterIndex = 1
.nMaxFile = Len(.lpstrFile) - 1
.lpstrTitle = "Locate DMATS data file"
'.Flags = cdlOFNFileMustExist
lngReturn = GetOpenFileName(OpenFile)
If lngReturn = 0 Then
GoTo Exit_Proc
End If
'.Flags = cdlOFNFileMustExist
If Len(.lpstrFile) > 0 Then
strFilename = Mid$(OpenFile.lpstrFile, 1, _
InStr(1, OpenFile.lpstrFile, Chr(0)) - 1)
Me.cboSelector = LCase(strFilename)
Me.cmdFinish.Enabled = True
FPath_Filename = LCase(strFilename)
End If
End With

Steve King Growth follows a healthy professional curiosity
 
Hello Aivars - my e-mail address is pellet1er@netscape.net. Thanks again...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top