PrintReport Error.

J

john

I am in access 2002 and HAVE REPORT BASED ON QUERY:
I have report layout like:

In header area: there are 6 control Total1,
Total2.... Total6
In Detail ares: there are controls: dTotal1.......
dTotal6 and dPer1.......dPer6.

When run the report. The header ares print OK. But All
controls in Detail Areas Print something: #name?. I know
it does not find reference. As you see my code, The both
reference to the same query return fields. I do not know
why in header's areas controls' controlsource can see the
query return fields and in detail areas can not see them?


the code is here:

Query: (run fine.)

TRANSFORM Round(Sum(amr_diag03s1.Vol_SIX_06_2003)) AS
[Sum]
SELECT Modal, market, Round(Sum
(amr_diag03s1.Vol_SIX_06_2003)) AS Total
FROM amr_diag03s1
WHERE marketer<>"@unknown"
GROUP BY Modal, market
PIVOT Marketer In ('Company 1','Company 2','Company
3','Company 4');


Code: (detail area print #name? on all controls)

private sub report_open()
setLayout
end sub

Private Sub setLayout()
Dim strRecordSource As String


Me.RecordSource = above query
Me.Controls("Modal").ControlSource = "[Modal]+
[Record_type]+[Market]"

'Detail Area controls

Me.Controls("dTotal1").ControlSource = "[Company 1]"
Me.Controls("dTotal2").ControlSource = "[Company 2]"
Me.Controls("dTotal3").ControlSource = "[Company 3]"
Me.Controls("dTotal4").ControlSource = "[Company 4]"
Me.Controls("dTotal5").ControlSource = "[Total]-
[Company 1]-[Company 2]-[Company 3]-[Company 4]"
Me.Controls("dTotal6").ControlSource = "[Total]"
Me.Controls("dPer1").ControlSource = "[Company 1]"
Me.Controls("dPer2").ControlSource = "[Company 2]"
Me.Controls("dPer3").ControlSource = "[Company 3]"
Me.Controls("dPer4").ControlSource = "[Company 4]"
Me.Controls("dPer5").ControlSource = "[Total]-[Company
1]-[Company 2]-[Company 3]-[Company 4]"
Me.Controls("dPer6").ControlSource = "[Total]"

'Header Areas
Me.Controls("Total1").ControlSource = "=sum([Company
1])"
Me.Controls("Total2").ControlSource = "=sum([Company
2])"
Me.Controls("Total3").ControlSource = "=sum([Company
3])"
Me.Controls("Total4").ControlSource = "=sum([Company
4])"
Me.Controls("Total5").ControlSource = "=sum([Total]-
[Company 1]-[Company 2]-[Company 3]-[Company 4])"
Me.Controls("Total6").ControlSource = "=sum([TOTAL])"

End Sub
 

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

Similar Threads

#Name? error on Report 0
Running sum in group header 2
Dynamic Crosstab - Repost 5
Dynamic Crosstab 3
still no dynamic crosstab report 0
Report-combining data 0
About Crosstab Query 1
Reports Grouping 5

Top