A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Print a report from a form based on a query



 
 
Thread Tools Display Modes
  #1  
Old May 14th, 2010, 08:57 PM posted to microsoft.public.access.forms
Mommybear
external usenet poster
 
Posts: 37
Default Print a report from a form based on a query

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.
  #2  
Old May 14th, 2010, 10:47 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Print a report from a form based on a query

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]
  #3  
Old May 18th, 2010, 05:40 PM posted to microsoft.public.access.forms
Mommybear
external usenet poster
 
Posts: 37
Default 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]
.

  #4  
Old May 18th, 2010, 06:49 PM posted to microsoft.public.access.forms
Mommybear
external usenet poster
 
Posts: 37
Default Print a report from a form based on a query

Ok, after taking a closer look at this, I found my problem. I had a typo in
my query. Works great. Thanks for the help

"Mommybear" wrote:

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]
.

  #5  
Old May 18th, 2010, 08:07 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Print a report from a form based on a query

On Tue, 18 May 2010 10:49:01 -0700, Mommybear
wrote:

Ok, after taking a closer look at this, I found my problem. I had a typo in
my query.


ah... a lump in the porridge! g

Glad you were able to get it fixed.
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.