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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email report not producing with emtpy output

Status
Not open for further replies.

onemiland

Programmer
May 29, 2004
18
US
I am producing an e-mail message to produce the contents of the current record from a form. When the Home, Work or Cell phone isn't present, the e-mail form doesn't work.

Any suggestions?

Code follows:

Private Sub M1_Click()
Dim strEmail, strBody As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)


strEmail = "acme@test.com"


strBody = strBody & "SM Name: " & Last_Name & " " & First_Name & " " & sMidInit & " " & sRank & Chr(13)
strBody = strBody & Left$(Social, 3) & "-" & Mid$(Social, 4) & " " & SMUnit & Chr(13) & Chr(13)
strBody = strBody & "Home Address" & Chr(13)
strBody = strBody & Address & Chr(13) & City & ", " & State & " " & Zip_Code & Chr(13)
strBody = strBody & "(H) " & Left$(Home_Phone, 3) & "-" & Mid$(Home_Phone, 4, 3) & "-" & Right$(Home_Phone, 4) & Chr(13)
strBody = strBody & "(W) " & Left$(Work_Phone, 3) & "-" & Mid$(Work_Phone, 4, 3) & "-" & Right$(Work_Phone, 4) & Chr(13)
strBody = strBody & "(C) " & Left$(Cell_Phone, 3) & "-" & Mid$(Cell_Phone, 4, 3) & "-" & Right$(Cell_Phone, 4) & Chr(13) & Chr(13)

strBody = strBody & "Work Address" & Chr(13)
strBody = strBody & WAddress & Chr(13) & WCity & ", " & WState & " " & WZip & Chr(13) & Chr(13)
strBody = strBody & AKO_eMail & Chr(13)


With objEmail
.To = strEmail
.Subject = "Soldier Data"
.Body = strBody
.Send
End With

Exit Sub

End Sub
 
Have you tried to play with the Nz function ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yeah I did, no results.


Any hints

Thanks for your help by the way
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top