End of Recordset - don't move to next record

S

Scott

I have the following code, but would like to indicate (where the XXXXXXX's
are) that unless at the end of the records docmd.gotorecord

However, I can't seem to get it write.

Here is my code


Private Sub Form_Current()



Dim outApp As Outlook.Application, outMsg As MailItem


Set outApp = CreateObject("Outlook.Application")
Set outMsg = outApp.CreateItem(olMailItem)

With outMsg
'.Importance = olImportanceHigh
.To = Me.ch_email & ";" & Me.proxy_email
.CC = Me.coord_email
.Subject = "" & Me.almostexpiredsubject



.Importance = olImportanceHigh



.body = Me.almostexpiredbody





.Send
End With





Set outApp = Nothing
Set outMsg = Nothing




XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx







End Sub


Thanks in advance for your assistance
 
S

Stefan Hoffmann

hi Scott,
I have the following code, but would like to indicate (where the XXXXXXX's
are) that unless at the end of the records docmd.gotorecord
However, I can't seem to get it write.
You want to sent an e-mail? Why do you use the Form_Current event? This
is normally the wrong event, you should use a CommandButton instead, e.g.

Private Sub yourCommand_Click()

Dim oa As Object
Dim rs As DAO.Recordset

Set oa = CreateObject("Outlook.Application")

Set rs = Me.RecordsetClone
If Not rs.BOF And Not rs.EOF Then
Do While Not rs.EOF

' Insert your code here
Set outMsg = outApp.CreateItem(olMailItem)
...

rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing

End Sub



mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top