Hi there can someone please help me out with this? It is really doing my head in.
I am trying to send a order confirmation report to our vendors.
Vendor is selected from a combo box then a command clicked to send the report.
I nearly have it working (I think) but i keep getting an error "invalid use of null". However column 2 is not null it contains an email address???
Thanks in advance for your help!
I am trying to send a order confirmation report to our vendors.
Vendor is selected from a combo box then a command clicked to send the report.
I nearly have it working (I think) but i keep getting an error "invalid use of null". However column 2 is not null it contains an email address???
Code:
Private Sub CmdEmailPrint_Click()
DoCmd.OpenReport "rptorderconf", acViewPreview
Dim strVendor As String
Dim strSend As String
If IsNull(Me.CboVendor.Value) Then
strVendor = "Like '*'"
Else
strVendor = "='" & Me.CboVendor.Value & "'"
End If
strSend = "[vendor]" & strVendor
With Reports![rptorderconf]
.Filter = strSend
.FilterOn = True
.txtrpttitle.Value = _
"Order Confirmation - " & Format(Date, "dd mmm yyyy") _
& vbCrLf & Me.CboVendor.Column(1)
End With
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String
If IsNull(Me.CboVendor.Value) = False Then
sToName = Me.CboVendor.Column(2)
sSubject = Me.CboVendor.Column(1) & " " & "Order Confirmation Test" & " " & Format(Now, "DD-MMM-YYYY")
sMessageBody = "Hi There"
DoCmd.SendObject acSendReport, "RptOrderConf", "snapshot format", _
sToName, , , sSubject, sMessageBody, True, False
End If
End Sub
Thanks in advance for your help!
