SendObject Only Goes through first record

A

AE

Hello. I am very new to macroing/vb. I have pieced together some script from examples I have found, but I am running into the problem that when I run the macro it only checks the first record then it stops. Any advice on how to make it run through all the records in the form

Function Email(
On Error GoTo Email_Er
Dim addy As Strin
Dim Customer As Strin
Dim Ticket As Strin

' Check for Emailed Statu
If Forms!Results!EMSnt = False The

' Get Customers Name and the PA Req Number From the Lo
Customer = Forms!Results!Requis_Emai
Ticket = Forms!Results!I
addy = Forms!Results!Manag_Emai

' Emails the ticket number to the custome
DoCmd.SendObject , , , addy, , , "Simple Paperless Approval Request", "Test",

'Sets emailed status to tru
Forms!Results!EMSnt = Tru

End I

Email_Exit
Exit Functio

Email_Err
MsgBox Error
Resume Email_Exi

End Function
 
S

Steve Schapel

AE,

This is not a macro. It is a VBA procedure, which is a very different
thing! In that sense, you are in the wrong newsgroup. But since you
are here, try this.... :)

Dim addy As String
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
With rst
Do Until .EOF
addy = !Manag_Email
DoCmd.SendObject , , , addy, , , "Simple Paperless Approval
Request", "Test", 0
.MoveNext
Loop
End With
 

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