Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / August 2008

Tip: Looking for answers? Try searching our database.

File Save dialog with Lebans ReportToPDF

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob Howard - 29 Aug 2008 18:07 GMT
Hi,

I just started using the Lebans ReportToPDF (Access 2003) and it's working
fine except I noticed an interesting situation...

When I use the option to have the FileSaveDialog shown, and when the user
enters the file path / name of a PDF that already exists, no warning occurs
regarding overwrite, etc.

Is there a way to turn this on?

Or do I need to bring up the dialog myself, check for this condition, give
the user a chance to change his/her mind, and then pass the file path / name
to the ReportToPDF function telling it NOT to issue the dialog itself??

bob h
John Spencer - 29 Aug 2008 18:30 GMT
I inserted the following into the code for the ConvertReportToPDF function.
This is about 46 lines down into Stephen's code .  That does not count blank
lines or comments.  About 4 screen pages on my monitor

Else
    ' Call File Save Dialog
    sOutFile = fFileDialog()
    If Len(sOutFile & vbNullString) = 0 Then
        Exit Function
    End If

'============================================================================
' Begin added code
' Confirm overwrite of existing file
' John Spencer Code Addition
'============================================================================
    If Len(Dir(sOutFile)) > 0 Then
      If MsgBox("Replace " & Dir(sOutFile) & "?", _
                 vbOKCancel, "Overwrite") = vbCancel Then
         Exit Function
      End If
    End If
'============================================================================
' --- end of added code ---------
'============================================================================

End If

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

> Hi,
>
[quoted text clipped - 12 lines]
>
> bob h
Bob Howard - 29 Aug 2008 18:54 GMT
that did it!  thanks so much...  bob

>I inserted the following into the code for the ConvertReportToPDF function.
>This is about 46 lines down into Stephen's code .  That does not count
[quoted text clipped - 46 lines]
>>
>> bob h
Bob Howard - 29 Aug 2008 19:31 GMT
>I inserted the following into the code for the ConvertReportToPDF function.
>This is about 46 lines down into Stephen's code .  That does not count
[quoted text clipped - 46 lines]
>>
>> bob h

Did you ever play around with setting a default file name (one that I can
pass as a variable) that shows in the file dialog??

bob
John Spencer - 29 Aug 2008 19:43 GMT
Not using the class code Stephen has for requesting the save location.  I've
done that with the code at
   http://www.mvps.org/access/api/api0001.htm

I just downloaded Stephen's example database yesterday.  That is something I
want to do, but have not yet seen if I can using Stephen's class code.  If
not, I can do it using the above code in place of his call to fFileDialog.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

>> I inserted the following into the code for the ConvertReportToPDF function.
>> This is about 46 lines down into Stephen's code .  That does not count
[quoted text clipped - 51 lines]
>
> bob
Bob Howard - 29 Aug 2008 19:55 GMT
> Not using the class code Stephen has for requesting the save location.
> I've done that with the code at
[quoted text clipped - 65 lines]
>>
>> bob

Thanks, John.  I'll also play with it a bit as I suspect we're heading down
the same path here...
I also note that Stephen uses the FileSave dialog ... I may also try using
the FileSaveAs dialog (it's slightly different...).  Bob.
Bob Howard - 29 Aug 2008 20:04 GMT
>> Not using the class code Stephen has for requesting the save location.
>> I've done that with the code at
[quoted text clipped - 70 lines]
> I also note that Stephen uses the FileSave dialog ... I may also try using
> the FileSaveAs dialog (it's slightly different...).  Bob.

Actually, elsewhere in my application I use the "ahtCommonFileOpenSave"
function by Ken Getz and Paul Litwin.  Perhaps I'll modify Stephan's code to
use their function rather than calling his class (as done today).  Their
functions accepts a default file name as the 6th (of 8)variable passed...
Bob
Bob Howard - 29 Aug 2008 20:49 GMT
> Not using the class code Stephen has for requesting the save location.
> I've done that with the code at
[quoted text clipped - 65 lines]
>>
>> bob

OK ... here's what I did...

In my program (before calling the Lebans code), I inserted a call the Getz /
Litwin function to get a filename.  I pass variables to set a starting
directory (I used "My Documents"), set a title for the panel, various flags,
a default file name, the extension (pdf), and a few other things.  It passes
back the chosen filename as a string (or an empty string if the user clicks
the Cancel button).

Unlesless the user clicked Cancel, I pass the result along to the Lebans
code to make the PDF.  In the function call to the Lebans code, I set it so
it would not open the file save panel.

And since the Getz / Litwin code already checks for saving to a file that
already exists, I removed the extra code that you previously provided me
that I had inserted in the Lebans code (there was no need for it anymore).

This is now all working together just fine!  And the Lebans code is back to
being unmodified (which I prefer).

bob h
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.