السلام عليكم
اساتذتى الافاضل .. بعد البحث كثيرا عن طريقة ارسال تقرير اكسس بالميل دون تدخل من المستخدم وجدت الكود التالى
Private Sub Command0_Click()
Dim oApp As New Outlook.Application
Dim oEmail As Outlook.MailItem
Dim fileName As String, todayDate As String
'Export report in same folder as db with date stamp
todayDate = Format(Date, "MMDDYYYY")
fileName = Application.CurrentProject.Path & "\myReport" & todayDate & ".pdf"
DoCmd.OutputTo acReport, "myReport", acFormatPDF, fileName, False
'Email the results of the report generated
Set oEmail = oApp.CreateItem(olMailItem)
With oEmail
.Recipients.Add "hamada.kamal", "Amr.Ashraf"
.Subject = "Test Access Data"
.body = "رسالة تلقائية لتجربة ارفاق تقرير لأكثر من مستخدم"
.Attachments.Add fileName
.send
End With
MsgBox "Email successfully sent!", vbInformation, "EMAIL STATUS"
End Sub
ولكن تظهر لى رسالة الخطأ التالية عند تشغيل الكود
compile error User-defined type not defined للسطر
Dim oApp As New Outlook.Application
تأكدت من References وان مكتبة Object Library موجودة ومفعلة ولكن المشكلة لم تحل ... المثال فى المرفق
Mail.rar