Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Troubleshooting Report's Query

Status
Not open for further replies.

Catadmin

Programmer
Oct 26, 2001
3,097
US
Hey, All.

I'm creating a multi-fact Crosstab report and have been using the Developer's Solutions Sample Database which came with the Access 97 on my computer. I've almost gotten everything done except I ran into a code problem on my Event Procedure. I keep getting a runtime error 2465 which keeps telling me it can't find my "OrderDate" field.

I have gone back to the query the report is based on several times and fiddled with it to try and fix the problem, but I'm starting to get frustrated because the rest of my code ran fine and I can't figure out why it can't find the "OrderDate" field when I added it. (Before this, I had the query doing a summary by month, then fiddled with the code to try and make it do a summary by year).

My main question is, when you update the Query the report is based on, does the Report automatically update or do you have to re-create the Report from scratch? Or is there another way to get the Report to update from the new saved Query?

Thanks for the help!

Brandie
Catadmin - New to Server Admin, but willing to learn... All help is appreciated.
 
Hi

if you have a report based on a query and change the query then the data available to the report may have changed.

if you referenced the OrderDate field in the old report and it dosent exist in the new query then that could be the problem

Error Code Error String
2465 Invalid reference to field '|'.

regards

Robert Dwyer
rdwyer@orion-online.com.au
 
Okay, I have written a different query at this point and rewritten, from scratch, the report as found in the Dev. Solutions Sample DB with changing the fields as appropriate. I keep getting stuck in the same place, my event procedure code on the control source for the OrderDate Header.


Here's the code I've co-opted from MS:

' Print data in correct column.
' Don't advance to next record or print next section.
If Me.Left < Me!LeftMargin + (Month(Me!OrderDate) + 1) _
* Me!ColumnWidth Then
Me.NextRecord = False
Me.PrintSection = False
End If


Basically, it is supposed to take my Qty, UnitPrice and Totals and put them under each month (jan, feb, march, etc) across the page for each Product I have. (IE, the report is a yearly totals of how many we ordered and what it costs us for each month of the year). Unfortunately, in the first report, it couldn't find my OrderDate field (as I said above) and now in this second, redone report, it keeps giving me an Error 2427 which is &quot;Object has no value&quot;. It keeps highlighting the first statement of the IF Code (from the IF to the THEN) in yellow. The state *looks* right to me, but then, I'm new to VB and I just typed it in directly from the sample DB.

I've looked at my LeftMargin and ColumnWidth properties to make sure they were set correctly and they seem to be right. I'm seriously confused.

Can someone take a look at this for me and let me know if it looks right or if I'm missing something?

Thanks,
Brandie
Catadmin - New to Server Admin, but willing to learn... All help is appreciated.
 
Hi Brandie,

Ok i don't see anything obvious, could you try to include some debug code to display the values

Me.Left
Me!LeftMargin
Me!OrderDate
Me!ColumnWidth

either try the debug print or add text boxes and assign the values of these items ahead of the if statement to check that they actually have values. It's just that the error message says that atleast one of them dosen't

regards

Robert Dwyer
rdwyer@orion-online.com.au
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top