If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Printing a Form from Access

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Oct 2003
Posts: 43
Printing a Form from Access

I know that a form is not suppose to be used for printing and rather have a report created to do the work for printing. However all of the users choices are done on the report and their is no good way I can think of to pass the control data from the form to a report without having to recreate the whole form in reporting.

My issue is that no matter what DoCmd.Printout I use I am getting one of two errors.

1. "The PrintOut Action was Cancelled"
2. Index or key field can not be null. (this is because I do not want the end user to save the data back to the tables and have turned off saving the form.

Any thoughts on how to get around this or another command I could use to get the form and my charts on the form to print?

Bill
Reply With Quote
  #2 (permalink)  
Old
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 11,020
Care to paste the offending code?
After a very quick test, simply using
Code:
DoCmd.Printout
with no parameters, appeared to do the trick for me.
__________________
George
Home | Blog
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Oct 2003
Posts: 43
George,

Here is the code:

Private Sub cmdPrint_Click()

On Error GoTo Err_cmdPrintPre_Click

DoCmd.PrintOut acPrintAll

Exit_cmdPrintPre_Click:
Exit Sub

Err_cmdPrintPre_Click:
MsgBox Err.Description
Resume Exit_cmdPrintPre_Click

End Sub

When I try to use just DoCmd.PrintOut I am getting error #1, when I do anything else under the DoCmd structure I am getting error #2. Note that this form does have a form on it as well as controls.
Reply With Quote
  #4 (permalink)  
Old
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 11,020
Have you got a default printer set?
What happens when the form is open and you click the print button off the access toolbar?

http://www.programmingtalk.com/showthread.php?p=142134
__________________
George
Home | Blog
Reply With Quote
  #5 (permalink)  
Old
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 11,020
And I would just like to voice my opinion of making reports instead of printing the form.

1) a lot clearer
2) uses less ink
3) avoids these painful problems ()
__________________
George
Home | Blog
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
Join Date: Oct 2003
Posts: 43
Quote:
Originally Posted by georgev
Have you got a default printer set?
What happens when the form is open and you click the print button off the access toolbar?

http://www.programmingtalk.com/showthread.php?p=142134
Yes I have a default setup. It prints a blank page.
Reply With Quote
  #7 (permalink)  
Old
Registered User
 
Join Date: Oct 2003
Posts: 43
Quote:
Originally Posted by georgev
And I would just like to voice my opinion of making reports instead of printing the form.

1) a lot clearer
2) uses less ink
3) avoids these painful problems ()

I do not disagree

Unfortunatly for some reason I can not tie the same control functions into a report that I can a form...
Reply With Quote
  #8 (permalink)  
Old
L33t Helpa Munky
 
Join Date: Nov 2007
Location: Adelaide, South Australia
Posts: 4,049
Yeah, beats me... I NEVER print forms.
__________________
Owner and Manager of
CypherBYTE, Microsoft Access Development Specialists.
Microsoft Access MCP.
And all around nice guy!


"Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
"...teach a man to code and he'll be frustrated for life! " -- georgev
Reply With Quote
  #9 (permalink)  
Old
Registered User
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 34
Seeing that you are getting the same response on dbforums as you are on programmingtalk, I would say perhaps its time for you to re-think your setup Bill.

Pete
__________________
DigiOz Multimedia
http://www.digioz.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On