Asking user if they want to view additional report.

Cwittmaack

Registered User.
Local time
Today, 12:23
Joined
Nov 3, 2009
Messages
70
I am having a problem with the code in the Close event on a report when asking the user if they want to view additional reports after closing the current report in preview. Report Closes after the Yes/No answer is selected. If yes selected it does nothing. If No is selected it does nothing, This code works fine in a data entry form after changing the close and open commands. Using Access 2010
Thank you all.

Code Using Now.

Private Sub Report_Close()
Dim IntAnswer As Integer
IntAnswer = MsgBox("Would you like to View/Print additional Reports?", vbQuestion + vbYesNo, "Yes")
If IntAnswer = vbYes Then
DoCmd.Close acReport, "CONFERENCE LOG", acSaveNo
DoCmd.OpenReport "CONFERENCE LOG REPORT", acViewPreview
Else
DoCmd.Close acReport, "CONFERENCE LOG", acSaveNo
DoCmd.OpenForm "CONFMENU"
End If

End Sub
 
The code looks allright, (if not the current report name is "CONFERENCE LOG"), try by setting a breakpoint in the code to follow it step by step.
Have you done a "Compact & Repair"?
Else try to put in the code in another report, to see if it make any difference.
If nothing doesn't help post a stripped version of your database + info in which report the problem is.
 
JHB

Will do tks
 
JHB

I have tried the code in a another report and did a compact and repair. No luck

The Attached DB is a Stripped down partial copy of what I’m doing, this is a database that I have been given to combine 3 other databases into one. The front end is called CENTRAL the tables are linked from CENTRALDB the report , forms, and Query is located in the Front end.
Again Thank you for taking a look at it.
 

Attachments

Yes - now I see what is going on! :)
The report you open from the form "CONFMENU", (titel:"CONFERENCE LOG MENU"), is "CONFERENCE LOG REPORT"!
The report that will open if you answer "Yes" when the report close, is the same report ("CONFERENCE LOG REPORT"), but the report is closing, therefore it will not show up.
If you make a copy of "CONFERENCE LOG REPORT" and rename it to "Copy Of CONFERENCE LOG REPORT" and put that name in your code, you'll see the code works ok. :D
The database is attached.

Code:
Private Sub Report_Close()
    Dim IntAnswer As Integer
        IntAnswer = MsgBox("Would you like to View/Print additional Reports?", vbQuestion + vbYesNo, "Yes")
    If IntAnswer = vbYes Then
        DoCmd.OpenReport "Copy Of CONFERENCE LOG REPORT", acViewPreview
    Else
        DoCmd.OpenForm "CONFMENU"
    End If
End Sub
Do you have a report in your original database with the name "CONFERENCE LOG" because it is not in the stripped version?
 

Attachments

That is a strange way of doing it but it does work, I just didn't get the name correct sorry, JHB, but I did notice that it leaves the first report open until you have entered all info for the second report. Once you have entered the information the first report will close. Do you have any suggestions on that part. Please let me know. Again Thank you.
 
Hide the report! :D

Code:
Private Sub Report_Close()
    Dim IntAnswer As Integer
        IntAnswer = MsgBox("Would you like to View/Print additional Reports?", vbQuestion + vbYesNo, "Yes")
    If IntAnswer = vbYes Then
        [B][COLOR=Red]Me.Visible = False[/COLOR][/B]
        DoCmd.OpenReport "Copy Of CONFERENCE LOG REPORT", acViewPreview
    Else
        DoCmd.OpenForm "CONFMENU"
    End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom