Solved

Print in landscape, form, report

Posted on 2013-05-11
8
519 Views
Last Modified: 2013-05-12
Experts,

I have this form.
I have a button on it to print.
I think it is best to print a report instead of the form.

on the button of my form I have this:

Private Sub cmdPrintTheRpt_Click()

    DoCmd.OpenReport "rptStatus_TenderPerDeal", acViewNormal, "", "[ID]=[Forms]![frmStatus_TenderPerDeal]![ID]", acNormal

End Sub

Open in new window


I basically am opening the report with the same ID as the the ID on the form.  Both report and form have the same recordsource (I saved the form as a report).  

When I press the button on the form, the code above returns a runtime error 2212:  "Cant print the report."...see pic below.  I got the code from online and I am not even sure why the code executes a PRINT because I dont see any code for PRINT (only OPEN).

How can I print the report but with the Where condition?  Any better ideas are welcome.  thank you.
untitled.JPG
0
Comment
Question by:pdvsa
  • 3
  • 3
  • 2
8 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39158485
Try this:
DoCmd.OpenReport "rptStatus_TenderPerDeal", acViewNormal, "", "[ID]=" & Me.[ID], acNormal

Open in new window


The above would work if ID is a Number data type.  If it is Text, you would need this instead:
DoCmd.OpenReport "rptStatus_TenderPerDeal", acViewNormal, "", "[ID]='" & Me.[ID] & "'", acNormal

Open in new window

0
 

Author Comment

by:pdvsa
ID: 39158525
Hi Irogsinta,

I see I had a misplaced quote...I still have that error though.  The fields are number fyi...

any other ideas?   thank you.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39158621
Do you still get the same error if you just try printing without a criteria?
DoCmd.OpenReport "rptStatus_TenderPerDeal"
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:pdvsa
ID: 39158854
Yes, I do  

but I dont have any errors if I add  acViewPreview :

DoCmd.OpenReport "rptStatus_TenderPerDeal", acViewPreview

What do you think now?  thank you
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 350 total points
ID: 39158991
do you have any default printer setup for the report?
0
 

Author Comment

by:pdvsa
ID: 39159453
There is a default printer but it is the network printer and I am not connected....printer is at work.
0
 
LVL 29

Assisted Solution

by:IrogSinta
IrogSinta earned 150 total points
ID: 39159475
There's your problem.  Change it to use your default printer and not a specific printer.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39159550
< the network printer and I am not connected...>

that is the reason why you are getting the error
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question