问题
Software: Microsoft Access 2007 SP2
Database File Version: Access 2000
I have an access program that I inherited from a previous employee. It uses forms for reports and since I don't have much experience in access I have continued to do this. I have created a copy of the program for another project and modified it to suit.
I am having trouble getting more then one chart to print. All the charts display in form view, they all have the same properties (excepting data, position, etc.) For some reason they are not printing. They don't even show up in the print preview.
I am thinking it must be something with the graphs themselves as they sometimes lose all information. I have to open the graphs in edit mode and change the data source from column to row and back again so that it gets redrawn. (Refresh doesn't fix it)
So right now I don't even have a clue as to where to look so ideas are welcome.
Edit #1
It seems to be a problem with linking to an unbound form.
Subform Field Linker: Can't build a link between unbound forms.
The query for the main form is
SELECT tTest.ixTest, tMotorTypes.ixMotorType, tMotorTypes.asMotorType, tMotorTypes.fDeprecated, tTestType.asTest, tTest.asSerialNum, tTest.asOrderNum, tTest.asFrameNum, tTest.asRotorNum, tTest.asOperator, tTest.iStation, tTest.dtTestDate, tTest.ixTestType
FROM tMotorTypes
INNER JOIN (tTestType
INNER JOIN tTest ON tTestType.ixTestType=tTest.ixTestType)
ON tMotorTypes.ixMotorType=tTest.ixMotorType;
The query for the chart is:
SELECT qGraphRSTTemperatures.Frequency, qGraphRSTTemperatures.[Drive End], qGraphRSTTemperatures.[Non Drive End], qGraphRSTTemperatures.[Air In], qGraphRSTTemperatures.Core
FROM qGraphRSTTemperatures
ORDER BY qGraphRSTTemperatures.ixTemperature;
Query qGraphRSTTemperatures:
SELECT tElectricalData.dblFrequency AS Frequency, tTemperatures.dblDrvEnd AS [Drive End], tTemperatures.dblNonDrvEnd AS [Non Drive End], tTemperatures.dblAirIn AS [Air In], tTemperatures.dblCore AS Core, tSubTest.ixTest, tTemperatures.ixTemperature
FROM (tSubTest INNER JOIN tElectricalData ON tSubTest.ixSubTest = tElectricalData.ixSubTest)
LEFT JOIN tTemperatures ON tElectricalData.ixElectrical = tTemperatures.ixElectrical
WHERE (((tSubTest.ixSubTestType)=5))
ORDER BY tSubTest.ixTest, tTemperatures.ixTemperature;
So how come, in the form view it shows the graph with the correct data when linked thus:
Child field: ixTest
Master field: ixTest
but won't print the graph.
The graph will print if I remove the links, but then I have all the data from chart query as it is not limited by ixTest.
edit #2
It seems to be a data retrieval/rendering issue in printing. Is there anything in printing that changes the context of records with respect to parent/child relationships?
回答1:
Check the "Display When" Property of the control and make sure it's set to "Always" (if you do it via code then Always is 0).
Some other things to look for would be the "Auto Activate" property. I believe it's set to "double click" by default.
回答2:
My solution to work around the problem.
I created separate reports with the graphs/charts in them. I just copied & pasted the charts from the forms into the reports and they worked.
I didn't want to do it this way as it uses a couple sheets of paper more than before. I am also dissatisfied with this solution as the question of why still remains.
回答3:
Ran into a similar problem... Reports with graphs were working fine until I had an invalid syntax issue with the report code that I did not catch.
apparently the code for the report would not compile correctly, so it did not link up to the graphs and sub reports correctly and I would get the same errors even when manually putting in the link fields.
My advice would be to check the code on the form or report... then compile the code and fix any problmes. Hope this helps.
回答4:
I have a similar problem with a report. I created a graph that is in a group to give me a separate graph for each category (say divisions). The graphs all display fine in the report view (for each division) and the print preview but when I print to a pdf only the first graph prints. If I open the report and go to the print preview and then print to a PDF it works great. If this is the problem you are having here is my work around:
I used VBA to follow a sequence to solve the problem. When a button is clicked on my main form the following events happen (1)Open the report in print preview (hidden), (2)open the print dialog box, after the PDF has been created the (3)report closes.
Dim stDocName As String stDocName = "My Reports Name"
(1) DoCmd.OpenReport stDocName, acViewPreview, , , acHidden
(2) DoCmd.RunCommand acCmdPrint
(3) DoCmd.Close acReport, "My Reports Name"
来源:https://stackoverflow.com/questions/888184/ms-access-mschart-graph-8-not-printing