Hi
I have a cmd button on a form to launch Outlook and populate the to: field with the email address from A2k, all works fine.
When the cmd button is selected and there is no data in the field an error message pops up [run-time error '94', invalid use of null]. I want to change the error message and instruct Access to ignore the cmd.
My code is as follows:
[Private Sub cmdEmail1_Click()
Dim Contact1emailaddress As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
email = Me!Contact1emailaddress
Set objOutlook = CreateObject("Outlook.Application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = email
Response = acDataErrContinue
.Display
End With
Set objEmail = Nothing
Exit Sub
End Sub
How would I amend the code to do this
Thanks
Steven811
I have a cmd button on a form to launch Outlook and populate the to: field with the email address from A2k, all works fine.
When the cmd button is selected and there is no data in the field an error message pops up [run-time error '94', invalid use of null]. I want to change the error message and instruct Access to ignore the cmd.
My code is as follows:
[Private Sub cmdEmail1_Click()
Dim Contact1emailaddress As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
email = Me!Contact1emailaddress
Set objOutlook = CreateObject("Outlook.Application")
Set objEmail = objOutlook.CreateItem(olMailItem)
With objEmail
.To = email
Response = acDataErrContinue
.Display
End With
Set objEmail = Nothing
Exit Sub
End Sub
How would I amend the code to do this
Thanks
Steven811