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.
0
Utf
5/14/2010 7:57:01 PM
access.forms 6864 articles. 2 followers. Follow

4 Replies
695 Views

Similar Articles

[PageSpeed] 49

On Fri, 14 May 2010 12:57:01 -0700, Mommybear
<Mommybear@discussions.microsoft.com> 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]
0
John
5/14/2010 9:47:58 PM
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
> <Mommybear@discussions.microsoft.com> 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]
> .
> 
0
Utf
5/18/2010 4:40:05 PM
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
> > <Mommybear@discussions.microsoft.com> 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]
> > .
> > 
0
Utf
5/18/2010 5:49:01 PM
On Tue, 18 May 2010 10:49:01 -0700, Mommybear
<Mommybear@discussions.microsoft.com> 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]
0
John
5/18/2010 7:07:29 PM
Reply:

Similar Artilces:

Printing double sided brochures in publisher
I am trying to print a tri-fold double sided brochure in Publisher - my problem is that the 2nd page prints upside down - how do you get both sides of the brochure to be printed the same direction? REDLED wrote: > I am trying to print a tri-fold double sided brochure in Publisher - my > problem is that the 2nd page prints upside down - how do you get both sides > of the brochure to be printed the same direction? If you're manually duplexing: Rotate the second page through 180° before reinserting it into the printer. If you're auto-duplexing: Change the options on ...

incorrect check / cheque number printing
When generating a cheque run, let’s say cheque 61, 62, 63 and 64, the information printed on cheque # 62 is actually cheque # 64 and vice versa. This does not happen every cheque run, but it does happen fairly often. I have not seen GP do this. What version and service pack of GP are you using? Are you 100% sure the check stock itself is not out of sequence? Do you have any customizations? -- Victoria Yudin Dynamics GP MVP Flexible Solutions, Inc. "Syed" <Syed@discussions.microsoft.com> wrote in message news:3B02ECEF-7436-4CF3-930E-AA4D2DFDF117@microsoft.com... ...

open two different Access reports
Hi, I was wondering if i can get some help here. I have two different reports that i want to open when a user clicks a button to view the reports for printing. Is there any way of popping them up at the same time in VBA? Thank you in advance Associates wrote: >Hi, > >I was wondering if i can get some help here. I have two different reports >that i want to open when a user clicks a button to view the reports for >printing. Is there any way of popping them up at the same time in VBA? > >Thank you in advance Yes. Call the DoCmd.OpenReport command twic...

Sort by Credit Card Type on EDC Detail Report
What do I have to do to get my EDC Detail Report to show different credit card types, like Visa, MC or Amex. Now under Tender Type, it just shows Credit card...well...I kinda knew that. How do I fix it? add tender types for each credit card type rather than just "credit card". then z out. all transactions after this change will reflect what you want in the reports. "tl" <tl@discussions.microsoft.com> wrote in message news:A54EEC95-208C-4962-A089-84B22A67632A@microsoft.com... > What do I have to do to get my EDC Detail Report to show different credit >...

printing 2 charts on single page
Using Excel 2k, Win 2k I was trying to print to line charts on a single page to demonstrate the corelation between the two data sets. I would like to print in portait mode with one chart on top of page and one on bottom. Excel only seems to offer putting chart 2 on a separate page or embedding it in chart one. I am not very familiar with excel charting capabilites can anyone suggest a resorce? Thanks ...

Word2007. Checkbox. No Form
Hello! We have a document (not a form) that we would like to use checkboxes in. This document has a couple of sections where it would be useful if the user could check if something is applicable. We can't protect the whole document. Thank you for your help! Stacey I actually used this feature in a form this morning. Although you don't say what version of Word you are using, you can access the Control Toolbox toolbar in Word 2003, or in Word 2007, it is on Developer tab. To show the developer tab, click the Microsoft Office Button and then click Word Options. S...

Web query timeout setting.
Dear Group, I fill an Excel table using data that I take from an Internet site. Unfortunately, this site is very slow and so I often get a "query did not provide any data" error message. How can I increment the default web query timeout limit? Thanks in advance, Enrico. ...

changing values of one field based on another
How can I best change the values of one field in a table based on values of another field of the same table. We have an existing table of thousands of entries and I would like to use the following logic to populate a new boolean field. If field1 = "Done" Then BooleanFieldCompleted = True I have some Excel VBA experience but limited Access. I dont want to do this manually! Any assistance appreciated. In general, you'd use an Update query. However, in this case I don't see why you'd need such a field. Why not just create a query with a computed field that returns True...

Comments to print on invoices and packing lists
We have a client with a specific need for printing customer comments and item comments: 1) They want to store comments on Customer Master. When a sales order is entered these comments should default on the sales order with an option to change. They want to mark these comments to be printed on sales order, invoice, packing list and pick ticket. 2) Items are stored with item specific comments. These comments need to come to the sales order when the order is entered with an option to change. They want to setup comments with similar setup where they print on order, invoice, pick ticket and packi...

I would like to know how to set up a 'fill in the blanks' form?
I would like to set up a templet of sorts to fill in the blanks for certificates. ...

Input to custom reports
Hello, I'd like to be able to input values to a custom report like the Year. Is there any way to package a custom report and provide input to it? Every year the user has to go into the custom report and change the Year restriction. Alternatively, (this is a payroll report), is there any global variable or some other back door that I can use to get the current year in a custom report? Given the report writer may not be the ticket what would the recommendation be to create custom reports that require input? VB.NET? -- Russ Using VBA you can allow for input in the custom reports. B...

printing multiple copies of Sigel GmbH
I have made a tent card in a small size of 5.588cm x 4.191cm for a swing tag, using Sigel GmbH in the "other labels" section. It prints one copy perfectly, leaving room on the page for at least about another 5 copies (which is what I want), but when in the print page section it doesn't give me the option to print multiple copies on the page. This will be an enormous waste of paper if I have to print the number of copies individually on each page. HELP! -- candere What is the product number for this label? I cannot find this size label on my 2007 version. -- Mary Sau...

printing imported gif files in Excel
When printing gif file with transparent background on the grey(25%) background of Excel non-transparent part of the picture has white border around it. Is there any way to prevent it? Thank you in advance... Tim ...

running reports from MS CRM prompt for username and password
Senario: When running a report from Microsoft CRM client it prompts for username and password. When given it's runs the report correct question: if MS CRM 3 is configured correctly is it normal that when trying to generate a report in MS CRM prompt for username and password? No, ideally it should pass the users AD credentials to the reporting IIS server (single sign on). If you were to close the browser and run a different report does it still prompt for credentials? I've noticed this does also depend on the hostname. For instance if the reporting server uses a differe...

Report to show Item Class Distribution Amounts
We would like to create a report, using Crystal Reports, that would show the following: dollar amount break down of the Sales Distribution accounts (COGS and Sales) per item class based on a date range. What is the most accurate way of going about this? We could only think of this method: (in short) sum the Ext Price based on SOP30300.CSLSINDX and SLSINDX and hope it matches the SOP10102 summed distribution amounts. Any advice would be appreciated. Thanks in advance. With the SLSINDX you would use the Extended Price and the CSLSINDX you would use Extended Cost. You would probably ...

isinteg reports configuring tstmgr failed : ecBadVersion
we have lost our mail after NAV did it's worst. have performed eseutil /p and /d as suggested elsewhere now get error from isinteg help please Update - have now sorted this thanks ...

Picture control on a form
What is the best way to fill a form with a picture control so that when the client window is resized the picture control will fill the form? -- Just Al Take a look at this and see if this is what you want: http://www.codeproject.com/dialog/bmpdlg01.asp Tom "Al" <Al@discussions.microsoft.com> wrote in message news:5BEA0FA2-3F95-4090-B908-A75DBF1D19DE@microsoft.com... > What is the best way to fill a form with a picture control so that when > the > client window is resized the picture control will fill the form? > -- > Just Al Thank You! -- Just Al &...

Null value in form not trapped by beforeupdate event
I have a form in Access 2003 linked to a SQL Server 2005 table. When I clear the value in a textbox (bound field is varchar and is required), I want the before update event to run to tell the user the value cannot be null. When I press the tab button to move to the next field after clearing the texbox, the before update event is not triggering and instead I'm getting the following error: You tried to assign the Null value to a variable that is not a Variant data type. (Error 3162) How can I prevent nulls before and this error from triggering? Thanks! ...

Determine a result of one column based on conditions in two column
Example Col A Col B Count the number of a's in Col B only when an x is in Col A x a x a Result should be 2 y a z p I can't figure it out x t x m Thanks try this =SUMPRODUCT(--(A2:A7="x"),--(B2:B7="a")) -- Hope this help Please click the Yes button below if this post have helped answer your needs Thank You cheers, francis "tel703" wrote: > Example > Col A Col B Count the number of a...

TSP100 printer and print width
Hi all, After pull my hair out for a half of day, I just find out that TSP100 printer driver reports its print width incorrectly when we use GetDeviceCaps to retrieve print width. Call GetDeviceCaps with PHYSICALWIDTH will report 1725 that is roughtly equal to 8.5 inches corresponding to 203ppi that LOGPIXELSX reported. Just let you all know This is a multi-part message in MIME format. ------=_NextPart_000_0048_01C92EF4.F767C240 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable After you installed the printer, did you change the p...

SQL query / Formula for Reorder Point?
Is it possible to issue an SQL command(s) that would: 1. Set the Restock Level for all items to be equal to the current on-hand quantity for each item. 2. Set the Reorder point for all items to be equal to 1/3 of that items Restock Level. I'm currently doing this manually, or using a formula in excel when items are initially imported into the DB, but there are still several thousand that need to be retro-fitted like this... Thanx in advance! -=RFM=- UPDATE Item SET RestockLevel=(Quantity - QuantityCommitted) UPDATE Item SET ReorderPoint=ROUND(RestockLevel/3,0) - Evan Culver Ne...

Crystal Report Launch 2
(sorry to repost this thread, but this was too old and I got no respones!) Can anyone explain this better? I can't find any documentation about this.........and techknowledge seems to be useless: http://www.greatplains.com/TechKnowledge/techknowledge.asp?print=true&id=28987&code=7842 can anyone show an example? I tried looking at the url of a report (almost a mile long!) and I indeed saw the paramters I put, but when I try to reopen that url in another browser I get this error: Unable to connect: incorrect log on parameters. File 7c433cc1d949d16.rpt. any help would be greatly ...

Printing in reverse order
When I try to print from excel and want the apges to print in reverse order (i.e first page of document printed last) even if I select this feature from the print setup exel still prints the first page first!! Is there a fix available?? I use Office XP (2002) and HP printers Thank you Printing options available in Excel are limited by the available connected printer(s). Any issues with printing are generally associated to the printer and drivers installed, not with Excel itself. Verify your printer actually supports reverse printing and that you have the latest drivers installed for ...

Printing contacts finally partially repaired
Two printing problems with Outlook 2007, the first solved, the second still not solved. First: So, finally, I don't know when, Outlook was repaired such that one could print out individual contacts as detailed address cards. This was broken for quite some time. Anyway, now those of us who choose to print out copies of address books are once again rewarded with this possibility. BUT..there is always a but, Outlook does not yet completely properly format the printing for all of the book and booklet possibilities which the software presents, especially for doing double...

Disappearing data in sync'd forms
I have a small sized text box in a form called frmMain. This text box may or may not contain a large amount of text. If the text box does contain alot of text I want to open up a new form called frmLargeText that contains a larger text box to allow the user to easily see and edit the large amount of text. I also need the two forms to stay in sync. i.e. if the user moves to a new record then both forms move to the same record. I thought I could do this by setting the recordset of frmLargeText to equal the recordset of frmMain as follows: Dim frm as Form_frmLargeText Dim rst As DAO.Rec...