Tip - Possible fix for "Microsoft Office Cant Find the Field 'X' referred to in your expression" err

  • Thread starter Thread starter D.Gabriel.Epstein
  • Start date Start date
D

D.Gabriel.Epstein

I've been struggling with this all night. It appears that visual basic
can't access a field from a report's underlying query or table unless
it has been bound to a control somewhere on the report. My solution:
Find a clear spot in your report, select all fields in your field list,
and dump them all onto the report as text boxes. Then go into
properties for the selected controls, give them all the same top, left,
and width values, set them to not visible, group them, cut them out,
and paste them in your report header. Hopefully this will not cause
access to melt... I have no clue as I am only trying it now, but it
seems to solve my immediate problem. Good luck!
 
Keith said:
This statement is false. What is it you're trying to achieve?

Keith.
www.keithwilby.com

Actually my experience is the same as the OP. If I need to use a field from the
Report's Recordset in the Report's code module I have to create a hidden TextBox
bound to that field or it doesn't work.
 
Rick Brandt said:
Actually my experience is the same as the OP. If I need to use a field
from the Report's Recordset in the Report's code module I have to create a
hidden TextBox bound to that field or it doesn't work.

Really? Maybe I misunderstood the OP, I thought that creating a recordset
in code that was the same as the report's source query would do the trick.
I've obviously missed the point.

Regards,
Keith.
 
Keith said:
Really? Maybe I misunderstood the OP, I thought that creating a
recordset in code that was the same as the report's source query
would do the trick. I've obviously missed the point.

Regards,
Keith.

I don't think the OP is creating a RecodSet in code. He was just trying to
refer to a field in the Report's RecordSource in the code of the report. If
that field is not actually being used by a bound control in the report VBA
will say it can't find it.

The same syntax in a form is never a problem, but reports seem to optimize
the report's RecordSet by only pulling fields from the underlying
Table/Query that are actually being used.
 
Are you may be using different versions of Access?
Access 2003 seems to have restricted visibility compared
to Access 2002-. Perhaps this is another example?

(david)
 
Rick Brandt said:
I don't think the OP is creating a RecodSet in code. He was just trying
to refer to a field in the Report's RecordSource in the code of the
report. If that field is not actually being used by a bound control in
the report VBA will say it can't find it.

The same syntax in a form is never a problem, but reports seem to optimize
the report's RecordSet by only pulling fields from the underlying
Table/Query that are actually being used.

Duly noted, thanks Rick. I've never run across that little problem. :-)

Keith.
 
Back
Top