For a field on a report, I'm trying to use an If/Then statement to set the Control Source depending on the day of the month. I need one Control Source for days 1-14 and another for 15-31. To do this I put this into the report's open event:
If (Day(date) < 15) Then
here are the control source statements and the Else statement.
End If
On one report this works fine, but after I copy and paste the code into another report, when I try to open the report it gives the error:
Runtime Error 2427
You entered an expression that has no value.
After I click the debug button, it highlights the If/Then line:
If (Day(date) < 15) Then
I tried setting the problem report to the same query that the other report uses (they have many of the same fields and their queries are very similar) but it still gives the error. I made sure that I'm putting it into the report's Open section. For testing, I tried disabling the controlsource setting line and just using a command that changes the fore color, but same results.
**The word "date" in the If/Then line above is not a field on the report, it's the Access variable for the date. I tried to make the line say:
If (Day(date()) < 15) Then
but as soon as my cursor leaves the line it changes back to this:
If (Day(date) < 15) Then
Anyone know what would be causing this?
If (Day(date) < 15) Then
here are the control source statements and the Else statement.
End If
On one report this works fine, but after I copy and paste the code into another report, when I try to open the report it gives the error:
Runtime Error 2427
You entered an expression that has no value.
After I click the debug button, it highlights the If/Then line:
If (Day(date) < 15) Then
I tried setting the problem report to the same query that the other report uses (they have many of the same fields and their queries are very similar) but it still gives the error. I made sure that I'm putting it into the report's Open section. For testing, I tried disabling the controlsource setting line and just using a command that changes the fore color, but same results.
**The word "date" in the If/Then line above is not a field on the report, it's the Access variable for the date. I tried to make the line say:
If (Day(date()) < 15) Then
but as soon as my cursor leaves the line it changes back to this:
If (Day(date) < 15) Then
Anyone know what would be causing this?