By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,479 Members | 2,239 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,479 IT Pros & Developers. It's quick & easy.

report printing

P: 23
:) hi all Im strugling with the code to a print button I need it to print the last report it has created only

I am inputing data into a data base in form view and need to print a report of that data every time I type in the data they are in a Justified view as thats how I need the data

the code I got is

stDocName = "report"
DoCmd.OpenReport stDocName, acNormal
DoCmd.OpenReport "report", acViewPreview
DoCmd.SelectObject acReport, "report", False
DoCmd.PrintOut [acPrintRange = acPages], [PageFrom 1], [PageTo 1], [AcPrintQuality = acHigh]


its doing my head in please help :eek: thanks

Saloc
Jul 14 '06 #1
Share this Question
Share on Google+
3 Replies


100+
P: 179
Is this code part of a button, textbox, etc? What event procedure is being used (OnClick, OnCurrent, etc.). And, what error messages are you getting?

comteck
Jul 14 '06 #2

P: 23
Is this code part of a button, textbox, etc? What event procedure is being used (OnClick, OnCurrent, etc.). And, what error messages are you getting?

comteck

on click on current oh my now I really do have a headache

but I get no errors it just prints all reports out :mad: :confused:

I will check out and try to get more details
Jul 25 '06 #3

P: 23
This is a copy and paste of what I got can you help PLEASE :confused: :confused: :eek: :o


Private Sub Command22_Click()
On Error GoTo Err_Command22_Click


DoCmd.close

Exit_Command22_Click:
Exit Sub

Err_Command22_Click:
MsgBox Err.Description
Resume Exit_Command22_Click

End Sub
Private Sub Command26_Click()
On Error GoTo Err_Command26_Click


DoCmd.close

Exit_Command26_Click:
Exit Sub

Err_Command26_Click:
MsgBox Err.Description
Resume Exit_Command26_Click

End Sub
Private Sub Command27_Click()
On Error GoTo Err_Command27_Click

Dim stDocName As String

stDocName = "report"
DoCmd.OpenReport stDocName, acNormal
DoCmd.OpenReport "report", acViewPreview
DoCmd.SelectObject acReport, "report", False
DoCmd.PrintOut [acPrintRange = acPages], 1, 1, , 1


Exit_Command27_Click:
Exit Sub

Err_Command27_Click:
MsgBox Err.Description
Resume Exit_Command27_Click

End Sub


Private Sub Command27_DblClick(Cancel As Integer)

End Sub
Jul 25 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.