Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Print report when no Email address 1

Status
Not open for further replies.

barra47

Programmer
Dec 25, 2002
86
AU
I have a button on a form that will send an access report to the address in the field "email"
if there is no email address I want it to send the report to the printer

this is the code I am using behind the button.

DoCmd.SendObject acReport, "WorkOrder Loco", "SnapshotFormat(*.snp)", , "", , "Work order for JN:" & [JnAlpha], , True,
 
Try something like this:

Code:
Private Sub Test()

If Forms("FormName").Controls("Email").Value Is Null Then

DoCmd.OpenReport "WorkOrder Loco", acViewNormal

Else

DoCmd.SendObject acReport, "WorkOrder Loco", "SnapshotFormat(*.snp)", [Email], "", , "Work order for JN:" & [JnAlpha], , True, ""

End If

End Sub


*Make sure your report's default printer is set to where you want it to print.

Hope this helps,

Alex

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
Thanks Alex
I will try that on monday when I get back to work.

appreciate your help.
 
I tried the script above but got an error Object required
here is what I wrote

If Forms("Open Quote Page2").Controls("Email").Value Is Null Then


DoCmd.OpenReport "WorkOrder Loco", acViewNormal

Else

DoCmd.SendObject acReport, "WorkOrder Loco", "SnapshotFormat(*.snp)", , "", , "Work order for JN:" & [JnAlpha], , True, ""
End If
 
And what about this ?
If Trim(Me!Email & "") = "" Then
DoCmd.OpenReport "WorkOrder Loco", acViewNormal
Else
DoCmd.SendObject acReport, "WorkOrder Loco", "SnapshotFormat(*.snp)", Me!Email, "", , "Work order for JN:" & [JnAlpha], , True, ""
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV

That did the trick

This will save a lot of trees
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top