Strange "Enter parameter value" pop-up when control based on calculated field

D

Darin

For the life of me I can't figure this out...

I have added the following calculated field in the SQL that the report
is based on:

StatCheck: ((nz([p].[LineStatus])+(-(nz([p].
[LineStatus])=1)*((Trim(Left(nz([ShipCycles].[CycleLength],"00"),2)))
+255)))*10000000)+(DatePart("y",nz([p].[ActualShipDate],nz([p].
[EstShipDate])))*10000)+((nz([p].[Transporter])+(Len(nz([p].
[Pro#]))*10)+Abs(Asc(UCase(Left(nz([p].[Pro#]) & " ",
1)))-32))*10)+Abs(Asc(UCase(Right(" " & nz([p].[Pro#]),
1)))-32)-2147483648

The query itself runs fine: every record gets a valid value. All 26k
+ of them. But as soon as I add a control to the report with that
field as the control source, I get the "enter parameter value" pop-up
referencing the StatCheck field name. This is an existing report that
ran fine before adding this field. If I delete the control based on
that field, the error goes away. I've tried different names for the
field, I've tried saving the sql as an external query and basing the
report on the saved query. There is no typo in the controls record
source (in fact, I use the drop-down to select it from the list of
available fields). No matter what I do, I have no problems
calculating the value, I just can't get the answer onto my report.
The field ends up being empty on the report, despite the fact that
there's data for that field in the underlying query.

Any ideas?
 
D

Darin

Ugh, never mind. I'm such an idiot. It's a report I've had for some
time, and I forgot that I'm conditionally changing the recordsource of
the report based on a setting on a form. So even though I had added
that field to the recordsource of the report, I didn't add it to the
SQL that my code was switching the recordsource to when the report was
opened.

Never code when hung over.
 
A

Allen Browne

Yep: I can relate to being bitten by that one, Darin.

What I do now is to add a label to the report, saying "RecordSource set it
code." BackColor = red. Visible = No, but it still reminds me when I open it
in design view in a couple of years time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top