Rosy wrote:
Quote:
I would like to have a report print based on the filtered results of a
form. How do I set this up? |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Do as Steve suggested and use VBA in the form like this:
Set up a CommandButton on the form named "cmdPrintReport."
Set the button's Click event to [Event Procedure] and click the Build
button (on the right of the field).
Enter this code in the event procedure's space:
Private Sub cmdPrintReport_Click()
On Error GoTo err_
If Not IsNull(Me.Filter) Then
DoCmd.OpenReport "Report Name", WhereCondition:= Me.Filter
Else
MsgBox "Error: No Filter", vbCritical, "Print Report"
End If
Exit Sub
err_:
MsgBox "Error: " & Err.Description, vbExclamation
End Sub
Be sure to change the "Report Name" to your report's name.
HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBSmok1IechKqOuFEgEQJz7wCgukJ3UsxVG4XgC1TmFZQ+Hw RMUksAn3XD
4c3c2Nd7ul0yLHb2tfQHxr5q
=GI3O
-----END PGP SIGNATURE-----