Access crash calling functions from shell32.dll and comdlg32.dll after using ado calls

J

Jouke

Hi all,

In an Access application (access 2000) running in Access Runtime
(2003) I have a problem which occurs just at one customer (running
2000 workstation in a Novell environment). The Access application uses
linked tables.

The following problem occurs. In the program we use file dialog en
directory dialog boxes to select files and directories. This works
fine except at this specific customer. Breaking down the problem it
works fine there if I have a form with a button. Click on the button
executes the code to op for example the directory dialog box. It goes
wrong when I first do some adodb calls (for example in the form load
event) and thenn execute the code for the directory dialog. No error
is generated. Access just quits completly.

The code for the directory dialog:

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
On Error GoTo errorHandling

Dim X As Long, bi As BROWSEINFO, dwIList As Long
Dim szPath As String, wPos As Integer

'set Properties
bi.hOwner = hWndAccessApp
bi.lpszTitle = szDialogTitle
bi.ulFlags = BIF_RETURNONLYFSDIRS

' Open browser window
dwIList = SHBrowseForFolder(bi)
szPath = Space$(512)
X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)

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

' Sub exit
Exit Function
'ErrorHandling
errorHandeling:
makeErrorReport Err.Number, Err.Description,
"DirectoryDialog:BrowseFolder"
Exit Function
End Function

This works fine until I first do some ado stuff like:

Private Sub Form_Load()

Dim rst As New ADODB.Recordset
rst.Open "tblABC", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
rst.Close
Set rst = Nothing

End Sub

The version of the dll's is checked and are up-to-date. Any
suggestions on how to solve this problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top