By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,461 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

API Calls in lieu of Common Dialogs Control

P: n/a
Perhaps a couple of tips regarding API calls using a function module
and I will be on my way to retiring the bug prone Common Dialogs

One Common Dialog that I have been using is shown below and has worked
fine. I'm have been using it to copy a few queries in HTML format to
disk. So the main point is how to properly referenced an OutputTo
action when using an API function call. So what should precede the

Of course, I would rather not lose the current features of having a
default string filter placing .HTML as the default in the Save as Type
box, and having a default path specified in the Save In box which is a
very beneficial feature of the current Dialog Control.

Thanks for your time and assistance.

Private Sub cmdOutput_Click()

Me!OutputTo? = GetOpenFile_CLT("C:\", "Save the Output")

' Dim oCmnDlg As CommonDialog
Dim strFormat As String
Dim strFileName As String
Dim stDocName As String
' Set oCmnDlg = Me!cmndlg.Object
On Error GoTo Export_Err
' With oCmnDlg

'.FileName = ""

'.Flags = cdlOFNOverwritePrompt + cdlOFNHideReadOnly

'.CancelError = True

'.Filter = "HTML Format (*.html)|*.html"

'.FilterIndex = 1

'.InitDir = "C:\Program Files\Database\Reports\"


'Select Case .FilterIndex

'Case 1
'strFormat = acFormatHTML

'End Select
'strFileName = .FileName
'End With
stDocName = "HTML Output"

DoCmd.OutputTo acOutputQuery, "ReportData", strFormat,
strFileName, False, "C:\Program

Exit Sub

Exit Sub


If Err.Number = 32755 Or 2501 Then
Resume Export_Exit
MsgBox Err.Number & ", " & Err.Description
End If
Resume Export_Exit

End Sub
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
IF you want a working example of the browse dialog from

Grab shift by pass key example from my web site at:

There is a browse button on a form that opens up the file dialog via api.
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.