MS Access 2010-提交表单后发送自动电子邮件

时间:2018-07-19 10:38:16

标签: email ms-access

我一直在尝试获取Access数据库,以便在用户通过表单输入新记录后自动发送电子邮件以通知我添加的内容。我尝试使用:

Private Sub Form_AfterInsert()

Dim oApp As Outlook.Application
Dim oMail As MailItem
Set oApp = CreateObject("Outlook.application")

Set oMail = oApp.CreateItem(olMailItem)
oMail.Body = "Body of the email"
oMail.Subject = "Test Subject"
oMail.To = "Someone@somewhere.com"
oMail.Send
Set oMail = Nothing
Set oApp = Nothing


End Sub

但这只是给我一个错误:编译错误:用户定义的类型未定义。

0 个答案:

没有答案