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
Controls.

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
GetOpenFile?

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\"

'.ShowSave

'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
Files\Database\Template\ReportDataTemplate.html"

Exit Sub

Export_Exit:
Exit Sub

Export_Err:

If Err.Number = 32755 Or 2501 Then
Resume Export_Exit
Else
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

http://www.mvps.org/access/api/index.html

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.

http://www.attcanada.net/~kallal.msn.../msaccess.html
--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
No************@msn.com
http://www.attcanada.net/~kallal.msn
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.