Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / August 2005

Tip: Looking for answers? Try searching our database.

Problem with file dialog

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
keith - 08 Aug 2005 13:04 GMT
Hello,

I am using a form command button to open a file dialog so the user can
select a file.  From the VBA Access help, I obtained the following code and
pasted it into the Command2 control code as shown below.  Unfortunately, it
does not work.
The error received is ….

“User-defined type not defined”

I tried adding references to Visual Basic for Applications, but the problem
continues.

What is needed to make this code work?

The code example from the VBA help is shown below.
Thank you

keith

     Private Sub Command2_Click()

 
     Dim dlgOpen As FileDialog

     Set dlgOpen = Application.FileDialog( _
         FileDialogType:=msoFileDialogOpen)

     With dlgOpen
         .AllowMultiSelect = True ‘ need to change this to false to select
only one?
         .Show
     End With

      End Sub
Dirk Goldgar - 08 Aug 2005 14:33 GMT
> Hello,
>
[quoted text clipped - 10 lines]
>
> What is needed to make this code work?

You need to add a reference to the Microsoft Office <version> Object
Library.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

keith - 08 Aug 2005 15:26 GMT
HI Dirk,

Thanks very much.  This is very very helpful.  As a general rule, how do I
find the reference that is needed for any control.  Is there a comprehensive
crossreference somewhere?
Keith

> > Hello,
> >
[quoted text clipped - 13 lines]
> You need to add a reference to the Microsoft Office <version> Object
> Library.
Dirk Goldgar - 09 Aug 2005 17:53 GMT
> HI Dirk,
>
> Thanks very much.  This is very very helpful.  As a general rule, how
> do I find the reference that is needed for any control.  Is there a
> comprehensive crossreference somewhere?

I'm afraid I don't know of any.  The only real clue about the FileDialog
object that I'm aware of is the fact that it's described in the
"Microsoft Office Visual Basic Reference" section of the help system.
And even that is only evident if you look at the help for "FileDialog
Object", not "FileDialog Property".  That's not much to go on, is it?

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

keith - 11 Aug 2005 22:51 GMT
Hi Dirk,

Your suggestion is helpful. Thanks very much.
Keith

> > HI Dirk,
> >
[quoted text clipped - 7 lines]
> And even that is only evident if you look at the help for "FileDialog
> Object", not "FileDialog Property".  That's not much to go on, is it?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.