doran_doran
Registered User.
- Local time
- Yesterday, 19:24
- Joined
- Aug 15, 2002
- Messages
- 349
I am using following code to collect e-mail address from a subform to a text and then e-mailing them.
I would like for system to pop a message "You must populate at least one e-mail address" when the recordset is empty.
The following code puts all the records in a field call txttotalrecipients from a subform which is tie to a temp table called tbltmprecipients.
It's all working accept the msgbox and exit sub portion. May be i have them in the wrong place.
= = = code begin here = = =
Private Sub cmdSendMail_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim Recipients As String
Set db = currentdb()
Set rst = db.OpenRecordset("tbltmpRecipients", dbOpenDynaset)
If IsNull(Recipients) Then
MsgBox "You must populate at lease one e-mail address"
Exit Sub
Else
rst.MoveFirst
Recipients = rst.Fields("TotalRecipients")
rst.MoveNext
Do While Not rst.EOF
Recipients = Recipients & ", " & rst.Fields("totalrecipients")
rst.MoveNext
Loop
End If
Me.txtTotalRecipients = Recipients
rst.close
Set dbs = Nothing
Call SendNotesMailCOMVersion
End Sub
I would like for system to pop a message "You must populate at least one e-mail address" when the recordset is empty.
The following code puts all the records in a field call txttotalrecipients from a subform which is tie to a temp table called tbltmprecipients.
It's all working accept the msgbox and exit sub portion. May be i have them in the wrong place.
= = = code begin here = = =
Private Sub cmdSendMail_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim Recipients As String
Set db = currentdb()
Set rst = db.OpenRecordset("tbltmpRecipients", dbOpenDynaset)
If IsNull(Recipients) Then
MsgBox "You must populate at lease one e-mail address"
Exit Sub
Else
rst.MoveFirst
Recipients = rst.Fields("TotalRecipients")
rst.MoveNext
Do While Not rst.EOF
Recipients = Recipients & ", " & rst.Fields("totalrecipients")
rst.MoveNext
Loop
End If
Me.txtTotalRecipients = Recipients
rst.close
Set dbs = Nothing
Call SendNotesMailCOMVersion
End Sub