Problem with Report Not Recognising Field

WelshJohn

New member
Local time
Today, 04:06
Joined
Jan 16, 2013
Messages
9
Hi,
I've been having this problem for a while now so I really had to seek help for it.

Basically I have a Report based on a query. The query has about 40 fields across 2 tables. The query has a criteria limitation based on the Job No on one of the tables.
Everything else works fine. The Report displays the correct data, and the field I want is displayed fine on there.

However, when I open the Report Headers Print event, and simply print out the field name. I get a runtime error '2465' Microsoft Access Cannot Find the field referred to in your expression.

Code:
Private Sub ReportHeader_Print(Cancel As Integer, PrintCount As Integer)

    Debug.Print Me.UkasJob
    
End Sub
I really hope someone can help out, pulling my hair out with this. It works if I try to print out numerous of the other variables. I'm hoping its not corrupt because a while back I was getting a memory error and I had to rebuild.
 
Right, I just got home and tried that and It didnt work. I made a bound text box to UkasJob, and then tried in the report header print sub to print Me.UkasJob. It didnt work.

Thought we had it aswell then. Any other ideas? Any way I can trick it?
 
Yes, intellisense links to the field when I type Me. And when linking the control source on the report, I type Uk it picks up on the field from the query. I have successfully linked about 30 other fields on the report in a similar way.

When I type Me.JobNo it works like expected. I'm starting to think that the report is corrupt somehow? I tried repair and compact and it still didn't work. Also tried on access 2003 and 2007.

Thanks for the help.
 
Pat, I just got it working. You were right about the Report needing a the field to be bound somewhere. What I was doing wrong was I was putting a the bound field in the Report header section, as it was the ReportHeader_Print sub where I needed the field. As soon as I bound the field in the Detail section of the Report it worked, even though that's not where I was using it.

Thanks for your persistence, we got there eventually!
 

Users who are viewing this thread

Back
Top Bottom