hello i have a form to send email on my db and work ok, but the problem is now i added a second field to CC receipts because sometimes i need to sent copy of the email to more peoples but using CC
the problem is that is I leave the CC field empty because I don't need to a an CC the system show RUNTIME ERROR 94 INVALID USE OF NULL
so how can I skip this error it cc field is empty, and the system send the email?
here is the code I am using:
Private Sub Send_Click()
Dim oApp As Outlook.Application
Dim oMail As MailItem
Set oApp = CreateObject("Outlook.application") 'this is the "instance" of Outlook
Set oMail = oApp.CreateItem(olMailItem) 'this is the actual "email"
'Here the body, subject, mail etc is hardcoded.
'You could get this info straight from the form and/or tables to have dynamic code
oMail.Body = Me.txtbody
oMail.Subject = Me.Txtsubject
oMail.To = Me.txtemail
oMail.Subject = Me.Txtsubject
oMail.CC = Me.txtcc
oMail.Send 'this sends the mail
Set oMail = Nothing
Set oApp = Nothing
End Sub
thanks in advance