我需要访问它,以便在他们的出生日期在 3 天内向某个客户发送电子邮件。
Dim rs as dao.recordset
set rs = currentdb.openrecordset(“DiscountEmail”)
with rs
if .eof and .bof then (No Records found for this query.)
Msgbox “ No emails will be sent because there are no records from the query ‘DiscountEmail’ “
else
do until .eof
DoCmd.SendObject acSendNoObject, , , ![Email Address Field], , , “Happy Birthday!”, “Hello ” & ![First Name Field] & _
“, ” & Chr(10) & “Come in on your birthday and receive a 10% discount!”, False
.edit
![Email_Sent_Date] = now()
.update
.movenext
loop
End If
end with
If Not rs Is Nothing Then
rs.Close
Set rs = Nothing
End If
我有这个代码,但现在我只需要这样做,如果某个客户的生日(在我的表“CustomerInfo”中)在 3 天内,它会向他们发送一封电子邮件,说他们可以在生日那天进来并收到一个折扣。
另外,我想让它自动发生(所以我不必按任何按钮),但它只发送一次,所以我可以明年再发送一次。
提前致谢!:)