Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Load Needing to Loop to next record....

Status
Not open for further replies.

ddbrook

Programmer
Aug 19, 2002
17
0
0
US
This is my code to load my form when I open it.
Which it works fine, but when I have 2 or more emails to send out for that day... Can someone show me how to loop to next record???? Please...

Private Sub Form_Load()
On Error GoTo Err_Form_Load

DoCmd.Maximize
DoCmd.GoToRecord , , acFirst
DoCmd.SendObject , , , Me.Email, [CC], , "Reminder for " & Me.ReportFor & " - Report Ref 00" & Me.ID, Me.ReportBody, Falso

Exit_Form_Load:
Exit Sub

Err_Form_Load:
MsgBox Err.Description
Resume Exit_Form_Load

End Sub

Thanks for your help again...
ddbrook
 
Hi dd,

There's probably a better way, but try this....

[tt]
DoCmd.Maximize
DoCmd.GoToRecord , , acFirst

While Not Me.ID '{Process if not last blank record}
DoCmd.SendObject , , , Me.Email, [CC], , "Reminder for " & Me.ReportFor & " - Report Ref 00" & Me.ID, Me.ReportBody, Falso

DoCmd.GoToRecord , , acNext
Wend
[/tt]

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience."
 
It might be a better way but it works!!!!
Worked great Darrylle.

Thanks again.
ddbrook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top