In trying to open a report, double clicking on it from the database window, the following error message shows up. I cannot figure out why it is being generated.
Error message:
The expression on open you entered as the event property setting produced the follow error:.
*The expression may not result in the name of a macro, the name of a user defined function or [Event Procedure].
*There may have been an error evaluating the function event or macro.
Here is the code behind the report:
Option Compare Database
Option Explicit
'I have commented out all other code in the module including the on no data event.
Private Sub Report_Open(Cancel As Integer)
Dim recSrc As String
recSrc = "SELECT * FROM [YearEndAcctRecQuery] WHERE ([YearEndAcctRecQuery].[DateSold] >= #1/1/2001# AND [YearEndAcctRecQuery].[DateSold] <= #1/1/2002#) AND [Recieved] = False;"
Me.RecordSource = recSrc
End Sub
When I paste the sql into a new query and run it, it works just fine and returns records. I also re-did the whole event procedure, (deleted [Event Procedure] from the onOpen event and started over) and that did not help either.
Any help would be greatly appreciated, I am tearing my hair out!!
betsyr
Error message:
The expression on open you entered as the event property setting produced the follow error:.
*The expression may not result in the name of a macro, the name of a user defined function or [Event Procedure].
*There may have been an error evaluating the function event or macro.
Here is the code behind the report:
Option Compare Database
Option Explicit
'I have commented out all other code in the module including the on no data event.
Private Sub Report_Open(Cancel As Integer)
Dim recSrc As String
recSrc = "SELECT * FROM [YearEndAcctRecQuery] WHERE ([YearEndAcctRecQuery].[DateSold] >= #1/1/2001# AND [YearEndAcctRecQuery].[DateSold] <= #1/1/2002#) AND [Recieved] = False;"
Me.RecordSource = recSrc
End Sub
When I paste the sql into a new query and run it, it works just fine and returns records. I also re-did the whole event procedure, (deleted [Event Procedure] from the onOpen event and started over) and that did not help either.
Any help would be greatly appreciated, I am tearing my hair out!!
betsyr