After adding 6 report and copying the code from one report
Code:
Private Sub Report_Close()
DoCmd.Restore
End Sub
Private Sub Report_Open(Cancel As Integer)
DoCmd.Maximize
End Sub
Private Sub Report_NoData(Cancel As Integer)
MsgBox "No data found for the year " & Forms!reportlist!cboYear & " !!"
Cancel = True
End Sub
and pasting the code into the other 5 reports, my FE blew up. It would open in design view but not in normal view.
Tried Compile & Repair.
Tried de-compile
It took me a week to discover it was the VBA project that was corrupt. Panic city. FE corrupt and data was due to be imported!!!!
I deleted the reports, imported the remaining objects into a new dB, all was OK. Imported the new reports... and bam!!! corrupt again.
I deleted the reports, imported the remaining objects into a new dB, all was OK again. Tried SaveAsText/LoadFromText for the reports. Was OK as long as I didn't import the reports with code.
Re-created the reports one at a time, saving, Compile & Repair between each report.
Then added the code to the reports: typed in the no data sub for one report, save, close the report, Compile & Repair, close the dB.
On to the on open sub. Same steps as above.
Then the next report. Same steps for the rest of the reports.
Took a lot of time (week and a half), but no corruption..... so far.
I think copying the 3 subs from one report into 5 other reports REALLY confused Access. Especially since the the sub names were the same.
In the future, I will not be mass copy & pasting code....
I have to add reports to print 1099's..... they are going into a new FE.. Not taking any chances