printing a report from a form

Hello,

I have set up a report to print right from a form. It prints whatever records are displayed on the form.
I thought it was working perfectly, until I realized that it was printing the same report over 11 times!
When you view it in print preview, there are 11 pages, but there should always be just one!

Help please!


Post your answer or comment

comments powered by Disqus
How can I print a report from VBA?
For example I have a report named rpt1, and I want to print'it from code, not after opening the report in preview mode?
Thanks,
Richard

What I am trying to achieve is to print a report using the command button but to only
print the information from the current form.
Another way may be to be be able to shortcut from the form to the print setup and limit the pages ???.

Any ideas gratefully received.

I am trying to print a report called 'Invoice' from a form showing the order details. I have set up a command button on the form to print the invoice with the event procedure as follows:


strDocName = "Invoice"
DoCmd.OpenReport strDocName, acViewPreview, , "[Invoice No]=Forms![Invoice]![Invoice No]"

When I press the print button i have a box coming up saying Forms![Invoice]![Invoice No]" and if in enter the invoice number then I can print the invoice for that number. How can i get it to work without having to manually enter the invoice number?

(I am quite new to this and have copied bits and pieces from other databases)

I wish to print a report from a form. The filed name is Vouchernumber and I wish to print the report from a particular vouchernumber to a particular vouchernumber in ascending order. For example from vno 35 to vno 85. I wish to create a print command button which may ask me from which vno to which vno I wish to present the report. I suppose I have to create a diallogue box form, if so what code is to be attached with the print command button. Thanks.

I have some trouble printing a report from a data access page.

The users fill out some fields in the data access page. I need a print function wich launches/prints the report (that also contains fields not entered in the access page).

The problem is that the users dont have access installed, and they therefore work on the intranet with access pages, instead of normal forms.

I have seen some forum treads about OpenFormWithInput(). Is there a similar function with reports?

Another issue is that I need the data access page to print the same post as the one the user has entered.
The index value is in both the access page and the report [moteID]

Can anyone help me with this problem?

Can anyone show me how to use the code
DoCmd.PrintOut acPages, Me.TxtFrom, Me.TxtTo
to print a report from a form?

Ok everyone,

I have been trying to print a report from a form with no luck. I know this seems to be a very simple problem, with nothing more than creating a button and putting the code in to print. However here is the twist. I want the output of the report to be in PDF format.

I have installed CutePDF and I have manually printed the report using this and it does exactly what I want. However the problem I hav is this, my default printer is not the CutePDF. So I need some help in figuring out the code to temporarily change my default printer to CutePDF, print the document (i.e. save to desktop as PDF document and configure it as landscape), then set my default printer back to the original printer.
I have figured the code on how to select a default printer using a combo box, but this is not the route I want to take. I want it done automatically, because the printers will not change.

Thank you in advance.

Hello forum,
Can anyone give me a few pointers on the following...
I want to print a report from a command button on a form, the number of which is taken from the 'OrderID' field on that form. I could be quite wrong, but I am assuming that if I attach a piece of code to the 'OnLoad' event on the form I can Bookmark the 'OrderID' and use it to referance the correct report for the print command. Can anyone tell me how to do this, or will it just not work? My limited knowledge has reached its end! Thanks in advance,

Nick

I have a Report from a Query. The Query has three Criteria [ ] it asks for. I enter the info for the 3 Criteria upon opening the Report. When i go to print the Report I have to re-enter the 3 Criteria. Is there a way to just print the Report with the initial info entry after viewing it without re-entering the info? Am I missing a Property Sheet Toggle or something easy or will I have to build a macro?

Buddus

Hello All,
I am trying to print a Report from Form where the Form was built by a Query. I set up the command button on the form and I get all the records on the form. I just want to print the opened form.

Thanks in Advance
Al

I have a very basic Access 2000 database for keeping track of my sales in a publication.

I am printing a report from a query. In the query, a company is listed twice... the two records for this company are different as in one field, which represents the page number the company is on, is different (1 & 108).... However, the report will not show the company twice. Yet, it leaves a space for it and the total for sales at the bottom of the report is correct (includes the invisible record)..... what do I need to do to have this second record show up?

Thanks,

George II

I would like to print a report of a specific record from a form and am using the procedure below. But I get the following error "Run-time error 3075. Syntax error (missing operator) in query expression 'Order_No = 010510-02CC'". Am I missing something here?


Private Sub cmdPrint_Click()

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "There are no data for this record. Please select another record."
Else
DoCmd.OpenReport "Order", acViewPreview, , _
"Order_No = " & Me!Order_No
End If
End Sub

I have a form where I am trying to open a report from a check box. The form has a sample ID and I am trying to run the report from the query for this sample ID. How can I pass this to the report so the report opens for this sample ID then prints, then closes.
Thanks!

Hello All, I have a form in MS Access that I want to fill out like an invoice and then print just that particular order using a report but I can't seem to get it to work.

Can someone help please?

Here is the code I am using from a command button to open the report but it shows errors for the fields:

Sub PrintInvoice_Click()

Dim strDocName As String
Dim strWhere As String
strDocName = "Orders"
strWhere = "[OrderID]=" & Me!OrderID
DoCmd.OpenReport strDocName, acPreview, , strWhere

End Sub

Thanks in advance.

I want to print a report from a from, using a command button that selects only the information from the current record. I currently have the form set up with a command button, when the button is clicked it it prints all of the records. I could add a parameter query to the command button also, but I don't want to do it that way. Any suggestions?

Can anyone tell me how to print a report of the current record of my form from a print button? I have a report template that is populated by the data but say when I am on record 6 of the form and hit the print report button I get all six pages instead of just a report of record 6. Any info is appreciated. Thanks.

I have a print button on a form that I want to use to print a report with only the data from the current record on the form.
Can anyone help please?
Keith

I am a forms developer with little reports experience. I am trying to pass a value into a report from a form. I have tried putting the following into the control source for the field on the report that I am trying to populate:
=[Form]![frmRptCriteria]![txtReportName]

Where frmRptCriteria is the form name and txt ReportName is the field. I thought it might be as easy as passing in arguments when calling the report and this works, the arguements go through however, I cannot assign the values to any of the objects on the report (I don't get a value parameter). When I us the expression above I get data on the report in access however when I attempt to print I only get #Name?

Help would be much appreciated, this can't be that difficult. Thanks in advance.

Dave

Hi there!

I have a listbox, (which grabs its data from a stored query) that can be sorted by the user using buttons on the form - eg i have a button which allows the user to sort listbox results by ascending price.

There is also a button which lets you print a report, which is generated containing the results of the original query.

However when the items are re-sorted by the user, according to (continuing with the example) ascending price, a new query is created on the fly in the onclick event for the button, using code such as:

Me.MyListBox.RowSource = "Select Field2, Field1 From SomeTable Order By Field2 Asc"
Me.MyListBox.Requery

The Report, however, doesn't know anything about this new resorted/reordered information, and so just prints in according to however it is stored in the original query?

Basic question is - i want to let the user print a report with the records viewed as they last sorted them in the listbox - how can i make and print a report which is generated using whatever query the listbox has? How can i change the record source to the latest query from the listbox?

I hope this is clear - i've been awake quite a long time now!

Thanks

Edd

I can't seem to get my print command to work. I'm using Access 2007 and have set-up a form with a cmdPrint button, with an event procedure, and a report. The code for the procedure is below. When I click on the button, basically nothing happens. Any ideas?


Private Sub cmdPrint_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenReport "Order_Summary", acViewPreview, , strWhere
End If
End Sub

Does anyone knows how to send a report to the printer directly from a procedure in a button click on another form?

I run a query to a temp table and open a report to be printed. Is there a way to print the report without the user having to press the print button in the report top?

hi, i have button on a form which prints a report.

can anyone post the code required to get the report to print.

report name : qry_invoice

i just cant suss it out.

my current code is:
DoCmd.OpenReport "qry_invoice", acViewPreview, , , acHidden
DoCmd.RunCommand acCmdPrint

but that just prints the form.

Jared James

hi
i use a command button on a form to print a report:
the code for this as we all know is:
DoCmd.OpenReport "myreport", acNormal
How do i print multiple copies of this report
Currently i am writing the above line thrice to generate 3 copies,
Is there another way
thanks
s talwalkar

Hi,

I am trying to get access to print an ID Card.

I've created a report which is the ID Card and that works fine, what I want to do is place a button on the employees form which will print the individuals ID card. I created the button on the form which is set to print the report but it is obviously printing the whole report (every ID card for every employee) I need to to filter so it only prints the ID card for the form I am looking at!

Is this possible?

Many thanks for any help.


Not finding an answer? Try a Google search.