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

ActiveX Control Within Access 2000 1

Status
Not open for further replies.

Zilloux

Programmer
Apr 3, 2001
3
FR
Hi,
How do I use a CommonDialog ActiveX X control in Access 2000?
The methods and properties are not the same at all than in VB...
Can someone tell me where I can find some Docs?
 
'You can try to use code what I used for saving of my reports. You may create new form, then add into form 1) "Microsoft Common Dialog control, vrsion 6.0" (MsComCtl.ocx), name it 'cmnDialog'; 2) text box, name it 'txtLocation'; 3) command button, name it 'pbBrowse". Then copy following code. Open form, push command button. Dialog window will appear.

Private Sub pbBrowse_Click()
On Error GoTo Err_pbBrowse_Click
Dim strFilter As String
Dim objDialog As Object
Set objDialog = Me.cmnDialog.Object
strFilter = "Rich Text Documents|*.rtf;All files|*.*"

With objDialog ' Ask for new file location.
.DialogTitle = "Save Report As..."
.FileName = "MyReport"
.InitDir = "C:\"
.Filter = strFilter
.FilterIndex = 1
.Flags = &H4 Or &H2 Or &H800 Or &H400 'cdlOFNHideReadOnly Or cdlOFNOverwritePrompt Or cdlOFNPathMustExist
.ShowSave 'Or:
'.ShowOpen
' If user responded, put selection into textbox on form.
If Len(.FileName) > 0 Then
Me.txtLocation = .FileName

End If
End With

Exit_pbBrowse_Click:
Exit Sub

Err_pbBrowse_Click:
If Err.Number <> 32755 Then 'An error 32755 is generated
'when the user chooses the Cancel button.
MsgBox Err.Number & &quot;: &quot; & Err.Description
End If
Resume Exit_pbBrowse_Click
End Sub
 
Sorry for being so late but thank you, it works.
The &quot;.Object&quot; was missing

Thanks,
ZIL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top