FileDialog Error # 438

G

Guest

I have a couple of FileDialog objects in an Access Database. They are both on
different forms. One is an msoFileDialogFolderPicker and the other one is an
msoFileDialogFilePicker.

If the user navigates to the form where the Folder Picker is used first
everything works fine. If the user then navigates to the form where the File
Picker is used, they get an Error #438...Object doesn't support this property
or method. It seems to be happening when I am trying to apply a filter via
the .Filters.Add process. It doesn't error if the user goes directly to the
form where the File Picker is located, and if the user closes the database
and then gets right back in it works fine. There must be something that I'm
not resetting...

Here's what I've tried...

I'm using a different variable for each instance:
Set pathselect = Application.FileDialog(msoFileDialogFolderPicker)
Set dlgOpen = Application.FileDialog(msoFileDialogFilePicker)

I'm setting each equal to Nothing after the dialog box is closed:
Set pathselect = Nothing
set dlgOpen = Nothing

I'm clearing out the filters before trying to apply the new filters:
.Filters.Clear

Anybody have any ideas on how to prevent this error?
Thanks!!
 
G

Guest

FYI - I think I figured out the problem...

In the Folder Picker I was setting an InitialFileName equal to a path that
was stored in a field on the table that the form was linked to. At the
conclusion of the picking the folder I was attempting to clear out the
..InitialFileName by typing this:

..InitialFileName = ""

It appears that this line of code was simply wiping off the last directory
of the path and not clearing it out. Later, when I'm calling the File Picker
it is keeping that path in its memory without the trailing slash ( \ ). When
I was attempting to apply a filter to it it was erroring out.

I don't want this InitialFileName to be kept in memory. How can I clear this
from memory so when the File Picker is called it doesn't automatically go to
the same folder?

Thanks!!
 

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