Sub send_mail()
Dim cnn As New ADODB.Connection
Dim send As ADODB.Recordset
Dim olkapp As Outlook.Application
Dim newmail As MailItem
Dim para As String
Dim i As Integer
Set olkapp = CreateObject("outlook.application")
Set cnn = CurrentProject.Connection
Set send = New ADODB.Recordset
send.Open "select * from send", cnn, adOpenKeyset, adLockReadOnly
If send.RecordCount < 1 Then Exit Sub
With send
para = "dear faf" + Chr(10)
For i = 1 To .RecordCount
para = para + Space(3) + CStr(.Fields(2)) + Chr(10)
Next
para = para + Space(20) + "super"
End With
send.Close
Set newmail = olkapp.CreateItem(olMailItem)
With newmail
.To = ""
.Subject = "abc"
.Body = para
.send
End With
End Sub
问题出来这
For i = 1 To .RecordCount
para = para + Space(3) + CStr(.Fields(2)) + Chr(10)
Next
有4行数据,为什么都是表里第一行的数据
[此贴子已经被作者于2006-7-17 14:37:31编辑过]
|