?
Solved

Print in landscape, form, report

Posted on 2013-05-11
8
Medium Priority
?
525 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

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 1400 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 600 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
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.
Suggested Courses

752 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