Add Error message if my me.combo box
is not selected for the following code?
Private Sub Command1_Click()
Dim Recipient As String
Dim RecipientCC As String
Recipient = Me.Combo10.Column(2)
RecipientCC = Me.Combo10.Column(3)
Dim DateText As String
DateText = Format(Date - IIf(Weekday(Date) < 3, 1 + Weekday(Date), 1), "MM-DD-YYYY")
DoCmd.TransferText acExportDelim, , "watchdog", "G:\Common\Auto Finance\WatchDog\watchdog_" & [DateText] & ".csv", True
'send email
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem
'get application
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If olApp Is Nothing Then Set olApp = New Outlook.Application
On Error GoTo 0
Set olMail = olApp.CreateItem(olMailItem)
With olMail
.Subject = "Indirect Auto Watchdog File"
.Recipients.Add [Recipient]
.CC = [RecipientCC]
.Attachments.Add "G:\Common\Auto Finance\WatchDog\watchdog_" & [DateText] & ".csv"
.Body = ""
.Display 'This will display the message for you to check and send yourself
'.Send ' This will send the message straight away
End With
MsgBox "Email Sent"
End Sub