Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

close dynamically report without saving prompt

Status
Not open for further replies.

xezekielx

IS-IT--Management
Jun 30, 2005
93
CA
Hi! I dynamically created a small report (with code) and I wanted to know if it was possible to close said report while avoiding the small "Do you wish to save" prompt. Thanks in advance!
 
This will always save changes:
DoCmd.Close acReport, "ReportName", acSaveYes

This will never save them:
DoCmd.Close acReport, "ReportName", acSaveNo

This will prompt you (DEFAULT):
DoCmd.Close acReport, "ReportName", acSavePrompt



Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Thanks GingerR but how can I "implement" the close event or whatever with a dynamically created report (I mean created with the CreateReport([parameters]) method) ? Thanks again for your answer!
 
Oh....I guess I thought you were already closing it, hence getting the message you didn't want to see....
Can't you just put it after your CreateReport code?


Code:
Function MakeNewReport()
    Dim rpt As Report
    Dim strOldName, strNewName As String

    strNewName = "GingerReport"
    Set rpt = CreateReport
    DoCmd.Restore
    strOldName = rpt.Name
    DoCmd.Save acReport, strOldName
    DoCmd.Close acReport, strOldName, acSaveNo
    DoCmd.Rename strNewName, acReport, strOldName

End Function


Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top