View Full Version : Report NoData Event


andycrfc13
08-18-2010, 03:05 AM
I have tried to enter some code into the NoData event on one of my reports, the code is as follows.


Private Sub Report_NoData(Cancel As Integer)
MsgBox "No Data"
On Error Resume Next
Cancel = True
End Sub



I can run this code and it works fine but when i try to save the report i get an error saying:
"You tried to commit or rollback a transaction without first beginning a transaction"

Does anyone know what the problem may be?

SOS
08-18-2010, 07:18 AM
First of all, using On Error Resume Next makes it almost impossible to figure out the true source of the error. Put a decent error handler in just to return the applicable information. It may be that this part is not causing you the problem but is, in fact, in your code which calls the report.

andycrfc13
08-18-2010, 11:38 PM
Thanks SOS

I actually got it working with the code that I had tried originally. It turns out that my report had come corrupt somehow, luckily i had a backup of the system. However i will still take your suggestion and try and work with it