您可以通过访问途径通过Outlook电子邮件发送会议或约会吗? [英] Can you send meetings or appointments by means of outlook emails through access?

查看:171
本文介绍了您可以通过访问途径通过Outlook电子邮件发送会议或约会吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家下午好,只是想知道是否有人知道在Access 2003中运行VBA或SQL代码时是否可以通过电子邮件发送会议或约会?以下是我一直在使用的代码发送

Good afternoon everyone, just wondering if anyone knew if it''s possible to send meetings or appointments through email when you run VBA or SQL code in Access 2003? The following is the code I''ve been using which sends


stSQL =" SELECT * FROM AddedToOutlook WHERE DatabaseReferenceNumber =" _

& recSet1(" DatabaseReferenceNumber2")

recSet6.Open stSQL,con6,adOpenKeyset,adLockOptimistic

如果recSet6.EOF那么

recSet6.AddNew

Dim outobj作为Outlook.Application

Dim outappt作为Outlook.AppointmentItem

设置outobj = CreateObject(" outlook.application" )

设置outappt = outobj.CreateItem(olAppointmentItem)

带outappt

.Start = recSet1.Fields(" NotificationDate2")_

& " " &安培; recSet1.Fields(" ApptTime2")

.Duration = 15

.Subject =" Contract Notification / End" &安培; " " _

& recSet1.Fields(" DatabaseReferenceNumber2")_

& " " &安培; recSet1.Fields(" Vendor2")

.Body =" Contract Notification / End" &安培; " " _

& recSet1.Fields(" DatabaseReferenceNumber2")_

& " " &安培; recSet1.Fields(" Vendor2")

.ReminderMinutesBeforeStart = recSet1.Fields(" ReminderMinutes2")

.ReminderSet = True

。保存

结束

recSet6.Fields(" AddedToOutlook")= True

recSet6.Fields(" DatabaseReferenceNumber")= recSet1。 Fields(" DatabaseReferenceNumber2")

设置outobj = Nothing

''DoCmd.RunCommand acCmdSaveRecord

recSet6.Update

结束如果

recSet6.Close

结束如果
stSQL = "SELECT * FROM AddedToOutlook WHERE DatabaseReferenceNumber = " _
& recSet1("DatabaseReferenceNumber2")

recSet6.Open stSQL, con6, adOpenKeyset, adLockOptimistic
If recSet6.EOF Then
recSet6.AddNew
Dim outobj As Outlook.Application
Dim outappt As Outlook.AppointmentItem
Set outobj = CreateObject("outlook.application")
Set outappt = outobj.CreateItem(olAppointmentItem)
With outappt
.Start = recSet1.Fields("NotificationDate2") _
& " " & recSet1.Fields("ApptTime2")
.Duration = 15
.Subject = "Contract Notification/End" & " " _
& recSet1.Fields("DatabaseReferenceNumber2") _
& " " & recSet1.Fields("Vendor2")
.Body = "Contract Notification/End" & " " _
& recSet1.Fields("DatabaseReferenceNumber2") _
& " " & recSet1.Fields("Vendor2")
.ReminderMinutesBeforeStart = recSet1.Fields("ReminderMinutes2")
.ReminderSet = True
.Save
End With
recSet6.Fields("AddedToOutlook") = True
recSet6.Fields("DatabaseReferenceNumber") = recSet1.Fields("DatabaseReferenceNumber2")
Set outobj = Nothing
''DoCmd.RunCommand acCmdSaveRecord
recSet6.Update
End If
recSet6.Close
End If



如果你想看到上面的代码你可以在这里看到它的完整背景:

http://www.thescripts.com/forum/thread581521.html


Willakawill帮助我了解了一下如果它已经添加了约会,并且这样做,他清理了我的所有代码的函数lol,这样你就可以更好地阅读他的代码版本了。


无论如何....在通过Outlook for MS Access 2003发送电子邮件方面,Microsoft建议使用以下代码:

If you want to see the above code in its full context you can see it here:

http://www.thescripts.com/forum/thread581521.html

Willakawill helped me out a bit with getting access to remember if it had already added the appointments and in doing so he cleaned up ALL my code for that function lol so you will be able to read his version of the code a bit better probably.

Anyways....in terms of sending emails through outlook for MS Access 2003, Microsoft recommends using the following code:


选项比较数据库

选项明确


Sub SendMessages(可选附件路径)

Dim MyDB As Database

DIM MyRS As Recordset

Dim objOutlook作为Outlook.Application

Dim objOutlookMsg作为Outlook.MailItem

Dim objOutlookRecip作为Outlook.Recipient

Dim objOutlookAttach作为Outlook.Attachment

将地址变为字符串


设置MyDB = Curren tDb

设置MyRS = MyDB.OpenRecordset(" tblMailingList")

MyRS.MoveFirst


''创建Outlook会话。

设置objOutlook = CreateObject(" Outlook.Application")


直到MyRS.EOF

''创建电子邮件。

设置objOutlookMsg = objOutlook.CreateItem(olMailItem)

TheAddress = MyRS![EmailAddress]


With objOutlookMsg

''将收件人添加到电子邮件中。

设置objOutlookRecip = .Recipients.Add(TheAddress)

objOutlookRecip。输入= olTo


''将抄送收件人添加到电子邮件中。

If(IsNull(Forms!frmMail!CCAddress))然后

Else

设置objOutlookRecip = .Recipients.Add(Forms!frmMail!CCAddress)

objOutlookRecip.Type = olCC

结束如果


''设置主题,正文和电子邮件的重要性。

.Subject = Forms!frmMail!Subject

.Body = Forms! frmMail!MainText

.Importance = olImportanceHigh''高度重要性


''将附件添加到电子邮件中。

如果不是IsMissing(AttachmentPath)那么

设置objOutlookAttach = .Attachments.Add(AttachmentPath)

结束如果


''解析每个收件人的名字。

For each objOutlookRecip In。收件人

objOutlookRecip.Resolve

如果不是objOutlookRecip.Resolve那么

objOutlookMsg.Display

结束如果

下一页

。发送

结束

MyRS.MoveNext

循环

设置objOutlookMsg = Nothing

设置objOutlook =没有什么

结束次级
Option Compare Database
Option Explicit

Sub SendMessages(Optional AttachmentPath)

Dim MyDB As Database
Dim MyRS As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheAddress As String

Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("tblMailingList")
MyRS.MoveFirst

'' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

Do Until MyRS.EOF
'' Create the e-mail message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheAddress = MyRS![EmailAddress]

With objOutlookMsg
'' Add the To recipients to the e-mail message.
Set objOutlookRecip = .Recipients.Add(TheAddress)
objOutlookRecip.Type = olTo

'' Add the Cc recipients to the e-mail message.
If (IsNull(Forms!frmMail!CCAddress)) Then
Else
Set objOutlookRecip = .Recipients.Add(Forms!frmMail!CCAddress)
objOutlookRecip.Type = olCC
End If

'' Set the Subject, the Body, and the Importance of the e-mail message.
.Subject = Forms!frmMail!Subject
.Body = Forms!frmMail!MainText
.Importance = olImportanceHigh ''High importance

''Add the attachment to the e-mail message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If

'' Resolve the name of each Recipient.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
MyRS.MoveNext
Loop
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub



(来自 http://support.microsoft.com/kb/318881/en-us


所以是我可以在这里添加一些命令,允许我添加会议或约会吗?我想添加新的会议和约会,但随后添加一份所有相关合同的清单(程序已经检查过),但由于它将在IF语句中被埋葬,因此可能不值得发送一份清单所有合同所以也许我只会发送一份新的合同....


我可以合并代码吗?一旦你设置收件人,它会发送约会和电子邮件吗?


无论如何...任何帮助将不胜感激。


干杯

(from http://support.microsoft.com/kb/318881/en-us )

So is there some command I can add into here that will allow me to add a meeting or appointment with this message? I want to add the new meetings and appointments but then add a list of all pertinent contracts (which the program checks for already) but then again since it will be burried in an IF statement maybe it will not be worth it to send a list of all contracts so maybe I''ll just send a list of the new ones....

can I just combine the code? Once you set the recipients will it send the appointments and the emails?

anyways...any help would be much appreciated.

Cheers

推荐答案

**对不起意思是说...将约会发送到我的电脑但不发送给其他电脑....某种方式让我自己离开...
**sorry meant to say...which sends appointments to myown computer but not to other computers....cut myself off there somehow...


我可以使用MeetingItem对象吗?我想这不能在Access''97中使用但可以在Access 2003中使用吗?
Can I used the MeetingItem Object? I guess this couldn''t be used in Access ''97 but can it be used in Access 2003?


Kosmos


我抢了这个代码来自某个地方,但我不记得在哪里。


玛丽

Kosmos

I robbed this code from somewhere but I can''t remember where.

Mary

展开 | 选择 | 换行 | 行号


这篇关于您可以通过访问途径通过Outlook电子邮件发送会议或约会吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆