Solved

Print in landscape, form, report

Posted on 2013-05-11
8
522 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

738 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