L
lilbit27
Can someone look at my code and tell me why my looping is not working?
Dim rst As DAO.Recordset
Dim strSQL As String
Dim db As Database
Dim rec As Database
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Dim strToWhom As String
strSql = "TARA.Keep='true'"
Set rst = CurrentDB.OpenRecordset(strSQL)
Do Until rst.EOF
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
..To = " "
..Subject = "Past Due Item"
..BodyFormat = olFormatHTML
..HTMLBody = "<HTML><BODY>" & "Insured: " & Me.InsName & "<br> " &
"Policy: " & Me.Policy & "<br> " & "SP Policy: " & Me.SpcPol & "<br> "
& "Trans Type: " & Me.TranType & "<br> " & "Effective Date: " &
Me.BillEffDte & "<br> " & "Gross: " & Format(Me.Gross, "currency") &
"<br>" & "Commission: " & Format(Me.Comm, "currency") & "<br>" & "Net:
" & Format(Me.Net, "currency") & " </BODY></HTML>"
..Display
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Its a continous form and I want them click on the check box called
"Keep" for every line that they want to pass to the body of the email.
So where keep is true open email and pass the identified fields for
each line
Dim rst As DAO.Recordset
Dim strSQL As String
Dim db As Database
Dim rec As Database
Dim olApp As Outlook.Application
Dim objMail As Outlook.MailItem
Set olApp = Outlook.Application
Dim strToWhom As String
strSql = "TARA.Keep='true'"
Set rst = CurrentDB.OpenRecordset(strSQL)
Do Until rst.EOF
'Create e-mail item
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
..To = " "
..Subject = "Past Due Item"
..BodyFormat = olFormatHTML
..HTMLBody = "<HTML><BODY>" & "Insured: " & Me.InsName & "<br> " &
"Policy: " & Me.Policy & "<br> " & "SP Policy: " & Me.SpcPol & "<br> "
& "Trans Type: " & Me.TranType & "<br> " & "Effective Date: " &
Me.BillEffDte & "<br> " & "Gross: " & Format(Me.Gross, "currency") &
"<br>" & "Commission: " & Format(Me.Comm, "currency") & "<br>" & "Net:
" & Format(Me.Net, "currency") & " </BODY></HTML>"
..Display
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Its a continous form and I want them click on the check box called
"Keep" for every line that they want to pass to the body of the email.
So where keep is true open email and pass the identified fields for
each line