StargateFanFromWork said:
On Tue, 20 Dec 2005 17:06:00 -0500, StargateFanFromWork wrote:
[snip]
I put the button and code to print one record, the one we're looking at at
that moment and everything works well except for one thing, the code takes
you to preview the report and you have to click the printer icon to print
it. In other words, it's too manual. Those are two extra steps that aren't
needed. Is there a way to just print this report automatically without
previewing once the button is pushed? If that could be done then this would
be exactly what I need.
Here is the code as given that does the preview thing:
********************************************
Private Sub cmdPrintRecord_Click()
Dim strReportName As String
Dim strCriteria As String
strReportName = "rptPrintRecord"
strCriteria = "[CustomerID]='" & Me![CustomerID] & "'"
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
End Sub
********************************************
I think I got it. I really didn't think I'd figure it out but it seems to
be working. I guess I'm always just a bit amazed when I manage to get
something to work that seems this complicated.
I created the report in the actual db (vs. the example Northwind). Rather
than the complicated code for Northwind, now that I'd tried that example and
could see working code, felt I could try to modify what you so kindly
posted. Mine looks like this now:
********************************************
Private Sub PrintRecord_Click()
DoCmd.OpenReport "ReportPrintRecord", acViewNormal, , "[DocketID] = " &
[DocketID]
End Sub
********************************************
I saw in help, now that I could plug in code name to look for <g>, that
"acViewNormal" would use report without previewing it (vs. "acViewPreview")
and that it would print directly. That seems to be the case. I just click
on printer icon and a printout of the currently-viewed record is generated.
This is _exactly_ what I needed. Is it really as easy as this? <g>
I can't say enough how valuable the help in this ng is. I just don't know
what I'd do without the group, so a big _thank_you_ once again!