Skip to main content

AccessTr.neT


Ek Data Tipli Bir Tabloda Dosyayı E-Mail Eki Yaparak Göndermek

Ek Data Tipli Bir Tabloda Dosyayı E-Mail Eki Yaparak Göndermek

Çözüldü #2
mail isimli formunuza aşağıdaki fonksiyonu ekleyin sonra o fonksiyonu çağırın ve dosya1 alanında sakladığınız eklentiyi geçici olarak bir klasöre kaydedin sonrada o klasördeki dosyları ekleyin.
Bu şekilde çözülür.
Örnek olarak eklemek için zamanım yok şu anda.

Public Function SaveAttachments(strPath As String, Optional strPattern As String = "*.*") As Long
Dim dbs As DAO.Database
Dim rst As DAO.Recordset2
Dim rsA As DAO.Recordset2
Dim fld As DAO.Field2
Dim dosyaad As DAO.Field2
Dim strFullPath As String

'Get the database, recordset, and attachment field
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("select * from mail where id =" & Me.id.Value)
Set fld = rst("dosya1")
Set dosyaad = rst("id")

'Navigate through the table
Do While Not rst.EOF

'Get the recordset for the Attachments field
Set rsA = fld.Value
'Set rsA = dosyaad.Value

'Save all attachments in the field
Do While Not rsA.EOF
If rsA("FileName") Like strPattern Then
strFullPath = strPath & "\" & rsA("FileName")
dosyam = rsA("FileName")
'strFullPath = strPath & "\" & rsA("ad")
Debug.Print rsA("FileName"), rst("id")
'Make sure the file does not exist and save
If Dir(strFullPath) = "" Then
rsA("FileData").SaveToFile strFullPath
End If

'Increment the number of files saved
SaveAttachments = SaveAttachments + 1
End If

'Next attachment
rsA.MoveNext
Loop
rsA.Close

'Next record
rst.MoveNext
Loop

rst.Close
dbs.Close

Set fld = Nothing
Set rsA = Nothing
Set rst = Nothing
Set dbs = Nothing
End Function


Public dosyam As String

Private Sub Komut36_Click()
SaveAttachments ("c:\eeee")

End Sub
komşuda dülger mi var geliyor keser sesi,
ustalar konuşunca çıraklar keser sesi.
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: Ek Data Tipli Bir Tabloda Dosyayı E-Mail Eki Yaparak Göndermek - Yazar: Kur@l - 24/12/2012, 20:13