Re: File Dialog

Tech-Archive recommends: Fix windows errors by optimizing your registry



I can't get it to work, I made a module with the following code, but I get an
error of can't find it. When I place the code on the form it works, but it
does not store the path on the control. The original code I made does
capture the path and place it on the control, but the link is dead. Will
API, if configured right, work by being placed inside the text box and then
be hyperlinked when clicked on?

Thanks,
'************** Code Start **************
'This code was originally written by Terry Kreft.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code courtesy of
'Terry Kreft

Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long

Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long

Private Const BIF_RETURNONLYFSDIRS = &H1
Public Function BrowseFolder(szDialogTitle As String) As String
Dim X As Long, bi As BROWSEINFO, dwIList As Long
Dim szPath As String, wPos As Integer

With bi
.hOwner = hWndAccessApp
.lpszTitle = szDialogTitle
.ulFlags = BIF_RETURNONLYFSDIRS
End With

dwIList = SHBrowseForFolder(bi)
szPath = Space$(512)
X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)

If X Then
wPos = InStr(szPath, Chr(0))
BrowseFolder = Left$(szPath, wPos - 1)
Else
BrowseFolder = vbNullString
End If
End Function
'*********** Code End *****************




"pietlinden@xxxxxxxxxxx" wrote:

On Jul 14, 11:43 am, Eli the Iceman
<ElitheIce...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
greetings,

I am tryihg to get FileDialog to work, I know about the ASP fie, but I
prefer to use the File Dialog as all I need is to paste a folder link in a
table via a form control. I got Filedialog to work, but am running into an
issue. My control on the form is a hyperlink, so if you paste the file path
or type it in, you can then click on the link and it will open a new window
of the path. However, when I select the path via FileDialog, it still shows
as a link, but will not follow it. Any suggestions?

1. store the path in your table as a text field.
2. use the BrowseFolder API at Access Web - use either a button or the
double-click event of the control.

.


Quantcast