Email from subform

  • Thread starter smcgrath via AccessMonster.com
  • Start date
S

smcgrath via AccessMonster.com

I have the following code on a command button to e-mail the names on the
subform but I a runtime error 3021 no current record. I cannot figure out
why when I know that there are records on the subform.

Private Sub Command37_Click()
Dim rs As DAO.Recordset
Set rs = Me.FrmSubRealtors1.Form.RecordsetClone
Dim tostr As String

With rs
Do Until RecordsetClone.EOF
If Not IsNull(!) Then
tostr = tostr & "," & ![Email]
End If
.MoveNext
Loop
.Close
End With
Set rs = Nothing
DoCmd.SendObject acSendNoObject, , , tostr, , , "Test", , , False
End Sub
 
M

mcescher

I have the following code on a command button to e-mail the names on the
subform but I a runtime error 3021 no current record.  I cannot figure out
why when I know that there are records on the subform.

Private Sub Command37_Click()
Dim rs As DAO.Recordset
Set rs = Me.FrmSubRealtors1.Form.RecordsetClone
Dim tostr As String

With rs
    Do Until RecordsetClone.EOF
      If Not IsNull(!) Then
        tostr = tostr & "," & ![Email]
       End If
       .MoveNext
    Loop
    .Close
End With
    Set rs = Nothing
DoCmd.SendObject acSendNoObject, , , tostr, , , "Test", , , False
End Sub
[/QUOTE]

You might try a .movefirst to get to the beginning of your recordset.
The other thing you might try is to print the string after you've
compiled it.

Debug.Print tostr

That will tell you what you've got.

Hope this helps,
Chris M.
 
T

tom_willpa

high quality Soccer jerseys NBA Jersey tracksuit and jackets, GHD
hairstraightener supplier from www.willpa.com

Are you a Retail businessman who bother by the purchase price? China
Cheapest TOP wholesale website can help you

we are specialize in replica sport goods manufacturing in china, we can
offer you all kinds of soccer jersey, NBA jersey,shoes and so on. they are
the best brand replica goods whih are look the same as the original goods.
excellent quality and steady supply for them. we have been marketed in Europe
and American for 3 year. all the goods we offer are AAA quality. our soccer
jersey are Thailand style. If any goods you buy from my company have problem,
we will refund or resend them again. Most of ourProducts have no minimum
order requirements,soyou can shop retail goods at wholesale prices. if you
can buy more than 300usd. We offer free shipping. The more you buy the more
discount for you.

National soccer jerseys: http://www.willpa.com
Club soccer jerseys: http://www.willpa.com
NBA Jerseys: http://www.willpa.com
T-shirt and shirt: http://www.willpa.com
Tracksuit: http://www.willpa.com
Hoody & Jackets: http://www.willpa.com
UGG boots: http://www.willpa.com
Hair style: http://www.willpa.com
shopping Index: http://www.willpa.com

EMS shipping. 7days arrive, paypal accept

want more information pls contact us or check our website: www.willpa.com
 

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