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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to pop-up the FILE OPEN dialog box ??? 1

Status
Not open for further replies.

marco02

Programmer
Feb 19, 2002
35
0
0
US
Hi,

I'm trying to pop up the FILE OPEN common dialog box for my user. The code below doesn't work! (comes from the "Developer's Handbook: Vol 1)

Dim cdl as CommonDlg
Set cdl = New CommonDlg
cdl.ShowOpen

Bugs at the first line. Declaration not accepted !! ...

thanks for your help on this matter,

marco
 
Put a common dialog on ur form and name it dlg1.

private sub CmdOpen_Click()
dlg.ShowOpen
end sub

 
i doesn't work Kendel,

moreover my calling this ShowOpen is not systematic in the procedure. It only happens in the specific case when the default path is not valid. So i don't want to attach it to a button.

Would my pbs have tsomething to do with a REFERENCE missing ? (Tools -> References ?)

thanks for your help!

marco
 
it doesn't work Kendel,

moreover my calling this ShowOpen is not systematic in the procedure. It only happens in the specific case when the default path is not valid. So i don't want to attach it to a button.

Would my pbs have tsomething to do with a REFERENCE missing ? (Tools -> References ?)

thanks for your help!

marco
 
Doesn't work? Dialog doesn't popup? Did you put a dialog on your form? You need to add the Microsft Common Dialog Control 6.0 for the Components. To use the dialog, no need to add any refference.

With dlgCommon
.InitDir = App.Path
.DialogTitle = "Open File As ..."
.Filter = "All Files|*.*|Text Files|*.txt"
.ShowOpen
End With
 
IT WORKS !!!
sorry for the late answer guys i got sick ....

For the next guy, here is the complete detailed procedure:

1) In a Form (whatever form) Toolbox -> More control ->
put the "Microsoft Common Dialog Control 6.0" control
somewhere in the form.

2) Go in Access VB editor

3) Tools -> Reference -> check "Microsoft Common Dialog Control 6.0". Validate

4) Code as follow:

Dim commonDlg As New CommonDialog
commonDlg.ShowOpen

Thanks guys, marco.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top