Brows for file button

chris_visible

Registered User.
Local time
Today, 08:45
Joined
Jan 17, 2002
Messages
24
Is it possible to create a button that allows a user to open a find file window to select a file, with the location being pasted into a text box on an access form.

If this is possible I would love to know how. If it is not possible I would like someone to tell me.
Please help
Thanks
 
It is possible. Search this forum for 'browse file' or something.

You had to use the CommonDialo control. Use the following code to open it an to put the path in a textbox:


CommonDialog1.CancelError = True 'CommonDialog1 is the name of the CommonDialogControl
On Error GoTo ErrHandler

' Set flags & filters:
'CommonDialog1.Flags = cdlOFNHideReadOnly
CommonDialog1.Filter = "All Files (*.*)|*.*|JPG files" & _
"(*.jpg)|*.jpg|MDB files (*.mdb) |*.mdb"


' Specify default filter
CommonDialog1.FilterIndex = 2

' Display the Open dialog box
CommonDialog1.ShowOpen

filename11 = CommonDialog1.filename 'put the path in the string filename11
'path.SetFocus
path = filename11 'put the string in a textbox.
Exit Sub

ErrHandler:
'User pressed the Cancel button
Exit Sub

Greetings,

Albert
 
Thanks very much. I will try that now. If I have any problems I will post them back here.
Thanks again
 
I dont think I have the CommonDialog Control in my visual basic 'References Library'.
What is the easist way to make it available?

Thanks
 
Hello,

I have the following references:

- Microsoft Common Dialog control 6.0
File: comdlg32.ocx

Albert
 

Users who are viewing this thread

Back
Top Bottom