Hello everybody.
I am developing database for my patients. I have almost the needed stuff but now struck at report level. At the end of all required data entry, I want to give prescription to my patients in printed form. For that I have made a report that opens in 'Report view' as a pop-up window. On that report, name it as 'rptOPDTreatmen t', I have put a command button 'cmdPreview' that I use to open report in 'Print Preview'. Now I want to go back to 'Report View', I have to right click on report border and select 'report View' to go back. Is there any vba code that I could place in 'OnClose' event that could reopen the report in 'Report View'..?
I have used following code in OnClose event
But it gives run time error '2585' 'This action can not be carried out while processing a form or report event.
I have tried TempVars.Add method to fetch the CurrentView Integer in OnLoad event but that did not work either.
Please help me solve this issue.
Thanks
I am developing database for my patients. I have almost the needed stuff but now struck at report level. At the end of all required data entry, I want to give prescription to my patients in printed form. For that I have made a report that opens in 'Report view' as a pop-up window. On that report, name it as 'rptOPDTreatmen t', I have put a command button 'cmdPreview' that I use to open report in 'Print Preview'. Now I want to go back to 'Report View', I have to right click on report border and select 'report View' to go back. Is there any vba code that I could place in 'OnClose' event that could reopen the report in 'Report View'..?
I have used following code in OnClose event
Code:
Private Sub Report_Close() Dim HisttID, rptView As Integer HisttID = Me.HistoryID rptView = Report.CurrentView If (rptView = 5) Then DoCmd.OpenReport "rptOPDTreatment", acViewReport, , "HistoryID = " & HisttID End If End Sub
I have tried TempVars.Add method to fetch the CurrentView Integer in OnLoad event but that did not work either.
Please help me solve this issue.
Thanks
Comment