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

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!
 
R

Rick Brandt

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.
 
K

Keith Wilby

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.
 
R

Rick Brandt

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.
 
D

david epsom dot com dot au

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)
 
K

Keith Wilby

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.
 

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