Runtime error 2465 mystry

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

What might cause a Runtime error 2465 (can't find
field referred to in your expression)?

The offending statement (below) in the Detail event
raises the error. Both Orchestra and CondName are
fields defined in the report's underlying query and they
both show up in the VBA object browser for the
report in question.

In verifying the above, I created a bound text box
and selected Orchestra as its control-source....no problem.

Me.tbOchCond = Me.Orchestra & vbNewLine & Me.CondName & " Conducting"

where tbOchCond is an unbound text box.

Bill
 
Interesting, I bound the text box to:
=[Orchestra] & Chr(13) & Chr(10) & [CondName] & " Conducting"
and the reference problem did not occur.

I'm still in need of the knowledge as to why the un-bound text
box can't be set as per my original post.

Thanks,
Bill
 
With reports, it isn't enough to only have the fields in the record source.
You must bind the fields to controls if you want to reference them in code.
 
Thanks Duane. If I can't deal with such cases as was shown
in my 2nd post, I'll simply obtain them from "invisible" bound
controls. Is there a better way?
Bill
 
I'm not aware of a better method if you need to use code to refer to the
value of a field. There is no reason to use code if you can simply place an
expression in a controlsource.
 
Oh for sure, I'd only mess with invisible controls if the
situation demanded otherwise. Though I didn't try it, I
assume I could even use a function invocation in the
controlsource if I needed to run some code.
Thanks again,
Bill
 
Back
Top