Print a report from a form based on a query
Private Sub PrintRpt_Click()
DoCmd.Hourglass True
DoCmd.OpenReport "Equipment Inquiry Report", acViewPreview
DoCmd.Hourglass False
End Sub
SELECT JHC.[Equip Code No], JHC.Description, JHC.[Equip Category],
Sum(JHC.[Exist Amt]) AS [SumOfExist Amt], Sum(JHC.[New Amt]) AS [SumOfNew
Amt], JHC.[Unit Cost], JHC.[Prime Mfg], JHC.Model, JHC.[Room Title],
JHC.Department, JHC.[Dept Desc], JHC.[Plan Room], JHC.[Furn\Install],
JHC.[Owner Furn Equip], JHC.Room, JHC.[Room No]
FROM JHC
GROUP BY JHC.[Equip Code No], JHC.Description, JHC.[Equip Category],
JHC.[Unit Cost], JHC.[Prime Mfg], JHC.Model, JHC.[Room Title],
JHC.Department, JHC.[Dept Desc], JHC.[Plan Room], JHC.[Furn\Install],
JHC.[Owner Furn Equip], JHC.Room, JHC.[Room No]
HAVING (((JHC.[Equip Code No])=[Forms]![Equipment Inquiry Form]![Equipment
Code No]))
ORDER BY JHC.[Plan Room];
"John W. Vinson" wrote:
On Fri, 14 May 2010 12:57:01 -0700, Mommybear
wrote:
I have a form that I enter a parameter and run a query which pulls anywhere
from 1-???? records. After these records are displayed, I have the option of
printing them (as a report) from a print command button which I can't get to
work. My form has a header with an Equip code and multiple detail lines.
This code is passed to a query which would run and pull my data again as the
report has more data in the online form. My problem is that this isn't
getting to the report. Am I making this more complicated than it has to be.
Please post your code and the SQL of the query. It's not at all clear to me
what you're doing, so I can't say if it's too simple, to complicated, or Just
Right.
(IIRC Mommy Bear found that her porridge was too hot... so maybe you ARE
making it too complicated g)
--
John W. Vinson [MVP]
.
|