Connecting Tech Pros Worldwide Help | Site Map

API Calls in lieu of Common Dialogs Control

  #1  
Old November 12th, 2005, 07:10 PM
Dalan
Guest
 
Posts: 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
  #2  
Old November 12th, 2005, 07:10 PM
Albert D. Kallal
Guest
 
Posts: n/a

re: API Calls in lieu of Common Dialogs Control


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
NoooSPAmkallal@msn.com
http://www.attcanada.net/~kallal.msn


Closed Thread