|
 |
access thread: Microsoft Common Dialog control in Access 2000
Message #1 by "Vernon Vincent" <vvincent@a...> on Thu, 10 May 2001 21:35:14
|
|
I am having fits trying to get the common dialog control to work. I am
wanting to open the dialog box programmatically so the user can select a
file from a directory.
Any suggestions, especially on where to look for more information, would
be appreciated.
Thanks,
Vernon L. Vincent
Message #2 by Imar Spaanjaars <Imar@S...> on Thu, 10 May 2001 23:19:53 +0200
|
|
Here is some sample code. This will set the filter to "XML" and "All"
files. It's not a comprehensive example, but it will provide you with some
methods and properties which you can look up at:
http://search.microsoft.com/us/dev/default.asp
On Error Resume Next
Dim sFileName As String
With CommonDialog1
.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*"
.FilterIndex = 1
.DefaultExt = "xml"
.Flags = cdlOFNFileMustExist
.DialogTitle = "Select source file"
.CancelError = True
.ShowOpen
sFileName = .FileName
End With
Hope this helps,
Imar
At 09:35 PM 5/10/2001 +0000, you wrote:
>I am having fits trying to get the common dialog control to work. I am
>wanting to open the dialog box programmatically so the user can select a
>file from a directory.
>
>Any suggestions, especially on where to look for more information, would
>be appreciated.
>
>Thanks,
>
>Vernon L. Vincent
Message #3 by "Pardee, Roy E" <roy.e.pardee@l...> on Thu, 10 May 2001 14:36:25 -0700
|
|
ActiveX controls are very frequently incompatible with Access. See
http://www.mvps.org/access/api/api0001.htm
For code that certainly works with A97, and will probably work with A2K as
well...
Cheers,
-Roy
-----Original Message-----
From: Vernon Vincent [mailto:vvincent@a...]
Sent: Thursday, May 10, 2001 2:34 PM
To: Access
Subject: [access] Microsoft Common Dialog control in Access 2000
I am having fits trying to get the common dialog control to work. I am
wanting to open the dialog box programmatically so the user can select a
file from a directory.
Any suggestions, especially on where to look for more information, would
be appreciated.
Thanks,
Vernon L. Vincent
Message #4 by "Derrick Flores" <Derrick_Flores@s...> on Fri, 11 May 2001 08:11:41 -0500
|
|
This will help you,
Private Sub cmdOpen_Click()
Me.txtStepper.Value =3D ""
dlgCommon.FileName =3D ""
'dlgCommon.Filter "Microsoft Excel (*.xls)" ' This is optional
'dlgCommon.InitDir =3D CurDir ' This is optional
dlgCommon.ShowOpen
If dlgCommon.FileName =3D "" Then
MsgBox "You Must Specify a File Name!", vbExclamation, "File Cannot Be
Opened!"
Else
Me.txtFileName.Value =3D dlgCommon.FileName
End If
End Sub
Private Sub cmdOpen_LostFocus()
If Me.txtFileName <> "" Or Not IsNull(txtFileName) Then
Dim a As String
a =3D Right(txtFileName, 12)
Dim b As String
b =3D Left(a, 4)
Me.txtStepper.Value =3D UCase(b)
End If
End Sub
Derrick A. Flores
Associate Systems Engineer
6" Line Engineering
Sony Electronic Inc.
Semiconductor San Antonio
1 Sony Place M/S 730
San Antonio, Texas 78245-2100
Telephone: (xxx) xxx-xxxx
Fax: (xxx) xxx-xxxx
Pager: (xxx) xxx-xxxx
E-mail: derrick_flores@s...
>>> "Vernon Vincent" <vvincent@a...> 05/10 9:35 PM >>>
I am having fits trying to get the common dialog control to work. I am
wanting to open the dialog box programmatically so the user can select
a
file from a directory.
Any suggestions, especially on where to look for more information,
would
be appreciated.
Thanks,
Vernon L. Vincent
|
|
 |