Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controls for allowing a user to select a file??

Status
Not open for further replies.

WhiteZiggy

Programmer
Jan 22, 2003
85
US
In VB there are controls you can set to allow the user to select the drive, then the file they want.

Are there such controls in Access and I am missing them?

Any suggestions?

I am passing the path the a module.

Thanks,
WZ

 
Hello WhiteZiggy,

No, Access does not have the Drives and Files form controls I believe you are referring to from VB :-(.

However, you can offer the same functionality by setting a reference to the Microsoft Scripting Runtime in your database. Then instantiate a FileSystemObject and use its drives and files collections as the source for a listbox or combobox on your form. Good Luck!

Have a great day!

j2consulting@yahoo.com
 
WZ,

In the VB Editor, set a reference to Excel in Tools/references

Then use the following code...
Code:
    Dim xl as Excel.Application, fn
    Set xl = CreateObject("Excel.application")
    fn = xl.GetOpenFilename
    If fn <> False then
       'do something with fn
    End if
:)


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884

Skip,
 
Thanks all.

I think I will go with the FSO.

The excel idea seemed great, but it locks up and freezes :(..for me anyway. I reference Excel 9.0 and it appears fine. It just freezes on line

fn = xl.GetOpenFilename


Thanks,

Jeremy
 
Perhaps a
Code:
xl.Visible=True
before the GetOpenFileName ?

Hope This Help
PH.
 
Skip,

No I do not. It seems to work.. I wll try the visible idea..Itwould be funny if default was visible = false..

Thanks,
WZ
 
Thanks SKIP .. and everyone else.

You can't set to visible because its not an object until it is called. But it did start working for me.

I think i had to just reference, then exit and save it. Then reenter and try and it works. My bad for not refreshing after adding reference..

Thanks all....

The White Ziggy..hehehe
 
Hey White,

If you use late binding you don't have to explicitly set a reference. The performance hit should be small for a feature that is infrequently used.

Late Binding Example:

Dim xl As Object, fn
Set xl = CreateObject(&quot;Excel.application&quot;)

I'm glad its working for you now. Good LucK!

Have a great day!

j2consulting@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top