#Name? error on Report

J

John

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

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

When run the report. All header ares print OK. But All
controls in Detail Areas Print something: #name?. I know
it do find reference. The query itself run fine. I got
result i want. Header areas controls and detail area
controls reference the same things. No error shows up in
setlayout procedure. Please anyone could help me and tell
me what is wrong?

the code is here:


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');


Private Sub setLayout()
Dim strRecordSource As String


Me.RecordSource = above query
Me.Controls("Modal").ControlSource = "[Modal]+
[Record_type]+[Market]"
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]"
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

Top