sdawson
Registered User.
- Local time
- Today, 21:11
- Joined
- Apr 22, 2003
- Messages
- 165
I'm using the following to e-mail a report from control button on form.
The purpose of the it then else is to open Outlook with the e-mail address of the recipient if stremail contains a value and open it with the recipient blank if stremail is empty.
All I get is the error message "Invaild use of null" if stremail is empty. If stremail has a value it's OK.
Any ideas or threads to follow?
++++++++++++++++++++++++++++++++++++++++++++++
Dim stDocName As String
Dim stremail As String
stDocName = "email report"
DoCmd.OpenReport stDocName, acViewPreview, , "[ID]=" & Forms![aform]![ID]
stremail = Reports![email report]![emailaddress]
If IsNull(Me![emailaddress]) Then
DoCmd.SendObject acReport, stDocName, acFormatRTF, , " cc address.co.uk ", ,
"Message content", "Some message", True
Else
DoCmd.SendObject acReport, stDocName, acFormatRTF, stremail, "cc address.co.uk", ,
"Message content ", " Some message ", True
End If
MsgBox "E-Mail has been sent"
DoCmd.Close , stDocName, acSaveNo
++++++++++++++++++++++++++++++++++++++++++++++
Ta
The purpose of the it then else is to open Outlook with the e-mail address of the recipient if stremail contains a value and open it with the recipient blank if stremail is empty.
All I get is the error message "Invaild use of null" if stremail is empty. If stremail has a value it's OK.
Any ideas or threads to follow?
++++++++++++++++++++++++++++++++++++++++++++++
Dim stDocName As String
Dim stremail As String
stDocName = "email report"
DoCmd.OpenReport stDocName, acViewPreview, , "[ID]=" & Forms![aform]![ID]
stremail = Reports![email report]![emailaddress]
If IsNull(Me![emailaddress]) Then
DoCmd.SendObject acReport, stDocName, acFormatRTF, , " cc address.co.uk ", ,
"Message content", "Some message", True
Else
DoCmd.SendObject acReport, stDocName, acFormatRTF, stremail, "cc address.co.uk", ,
"Message content ", " Some message ", True
End If
MsgBox "E-Mail has been sent"
DoCmd.Close , stDocName, acSaveNo
++++++++++++++++++++++++++++++++++++++++++++++
Ta