FileDialog object breaks program flow.

  • Thread starter Thread starter OfficeDev18 via AccessMonster.com
  • Start date Start date
O

OfficeDev18 via AccessMonster.com

Hello,

I have the following Dim statement in a module:

Dim fd As FileDialog

I have the library Microsoft Access10 Object Library referenced. However, my
program breaks on the Dim, with the error message "User type not defined."
It's been working 'til now. What's wrong?

I'm using A2003.

Thanks for the help,

Sam
 
I found the answer. When I opened the Object Browser, typed in "FileDialog",
and got the response (Access, Application, FileDialog), I clicked on the
active link "FileDialog" at the bottom of the page. I got an error message
saying "Cannot jump to FileDialog because it is in library Office which is
not currently referenced." Taking the hint, I added MS Office10 Object
Library to my references, and voile, everything works.

Interesting, but wierd.

Sam
 
Sam, if you are using Access 2003, it is not a good idea to use the Office
10 library. Use the Office 11 library if you must.

As you are discovering, FileDialog can break your application, and has
problems between versions. It does not work in the runtime version of
Access, and it does not work at all for Save As (even through it appears to
offer that option.

You would be much better off to dump FileDialog, and instead use the API
code from this link:
http://www.mvps.org/access/api/api0001.htm
It avoids all those problems.
 
Hi, Allen,

Oops, you caught me at my lie (red face). I'm using A2002, not 2003. Ergo,
Office10 is the only option.

Thanks for setting me straight.

Sam

ps I'm only using FileDialog for the FilePicker option.

Allen said:
Sam, if you are using Access 2003, it is not a good idea to use the Office
10 library. Use the Office 11 library if you must.

As you are discovering, FileDialog can break your application, and has
problems between versions. It does not work in the runtime version of
Access, and it does not work at all for Save As (even through it appears to
offer that option.

You would be much better off to dump FileDialog, and instead use the API
code from this link:
http://www.mvps.org/access/api/api0001.htm
It avoids all those problems.
I found the answer. When I opened the Object Browser, typed in
"FileDialog",
[quoted text clipped - 24 lines]
 
Back
Top