Also wanted to remind: Code written in Access 2007 running on Access 2010 with out going through an Import All Object:
This is one of the error tht did appear our of nowhere in the past.
Perhaps the Access SP have fixed that by now? Who knows? http://www.access-programmers.co.uk/forums/showthread.php?t=232352&highlight=2501
Opening an Access 2010 blank database and Importing All Objects from Access 2007 fixed this error with no code changes. I don't know why, and I really don't care. The point is, that the proper way to open an older Access 2007 using Access 2010 is to go through the process and Import all objects into Access 2010.
Maybe this can help others save some time to solve this pesky little error.
On Error GoTo Foutje
DoCmd.OpenReport "Sum Reasons", acPreview, , strFilter
DoCmd.SendObject acReport, stDocName
Exit Sub
Foutje:
If Err.Number = 2501 Then
MsgBox "Cancelled"
Else
MsgBox Err.Description
End If
End Sub