Skip to main content

AccessTr.neT


Ayrı butonlardaki farklı işlevleri tek buton ile gerçekleştirmek

Ayrı butonlardaki farklı işlevleri tek buton ile gerçekleştirmek

#5
(11/11/2016, 03:22)murat dikme yazdı: Özet raporda kastım Kaç tane kargocu, kaçtane misafir, kaçtane sipariş gelmiş bunları alabileceğim bir rapor oluşturmak.

Bu bahsettiğiniz mevzunun konu başlığı ile ilgisi yok.

Raporu excele aktarmak için

DoCmd.OutputTo acReport, "GELEN", acFormatXLS, CurrentProject.Path & "\Raporum.XLS"
Kodunu kullanabilirsin

Excele aktarılan raporu mail olarak göndermek için

Dim iMsg, iConf, Flds, schema, strRecip
Dim i As Integer
Dim strChar, GRapor As String


DoCmd.OutputTo acReport, "GELEN", acFormatXLS, CurrentProject.Path & "\Raporum.XLS"

GRapor = CurrentProject.Path & "\Raporum.XLS"


Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.gmail.com"
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "gondericiemail@gmail.com"
Flds.Item(schema & "sendpassword") = "gmail şifreniz"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update

With iMsg
.To = "[email protected]"
.From = "gondericiemail@gmail.com"
.Subject = "Mail Başlığı"
.HTMLBody = "mail İçeriği"
.Sender = "gondericiemail@gmail.com"
.Organization = "gondericiemail@gmail.com"
.ReplyTo = "gondericiemail@gmail.com"
If Not IsMissing(GRapor) Then
If Nz(Len(GRapor), 0) > 0 Then
   strRecip = ""
For i = 1 To Len(GRapor)
strChar = Mid(GRapor, i, 1)
If strChar = ";" Then
.AddAttachment (strRecip)
strRecip = ""
Else
strRecip = strRecip & strChar
End If
Next i
If Nz(Len(strRecip), 0) > 0 Then
.AddAttachment strRecip
End If
End If
End If

Set .Configuration = iConf
.Send

End With

Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
kodunu kullanabilirsiniz.

Koddaki [email protected] alıcının mail adresi, gondericiemail@gmail.com göndericinin gmail adresi, "gmail şifreniz" ise göndericinin gmail şifresidir.
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Cvp: Komut Düğmesi hk - Yazar: ozanakkaya - 11/11/2016, 09:27
Cvp: Komut Düğmesi hk - Yazar: atoz112 - 12/11/2016, 17:29
Cvp: Ayrı butonlardaki farklı işlevleri tek buton ile gerçekleştirmek - Yazar: ozanakkaya - 16/11/2016, 22:02
Task