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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|