sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Dalan's Avatar

API Calls in lieu of Common Dialogs Control


Question posted by: Dalan (Guest) on November 12th, 2005 07:10 PM
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
1 Answer Posted
Albert D. Kallal's Avatar
Albert D. Kallal November 12th, 2005 07:10 PM
Guest - n/a Posts
#2: 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.ms...s/msaccess.html


--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
Join Bytes!
http://www.attcanada.net/~kallal.msn


 
Not the answer you were looking for? Post your question . . .
196,918 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,918 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors