New Problem... My Loop is only getting first eMail address... Please Help!

B

Bob Quintal

All,

My Loop is only getting the first eMail address though it is
reapeating the address the correct number of times. Now what am I
doing wrong?


Dim dbsCurrent As Database
Dim rstRecords As Recordset
Dim SendWhat As String

SendWhat = "SELECT llListingID, pbeMailAddress FROM
qryBuyerByCounty WHERE (llListingID)= " &
Forms!frmSendeMailToMatchedBuyers!txtListingID & ";"

Set dbsCurrent = CurrentDb()
Set rstRecords = dbsCurrent.OpenRecordset(SendWhat, dbOpenDynaset,
dbSeeChanges, dbOptimistic)

With rstRecords
Do Until .EOF
txtTo = txtTo & pbeMailAddress & ";"
.MoveNext
Loop
End With


Thanks,
Gina Whipp

txtTo & pbeMailAddress & ";"
should be
txtTo & !pbeMailAddress & ";"

"I feel I have been denied critical, need to know, information!" -
Tremors II
 
G

Gina Whipp

All,

My Loop is only getting the first eMail address though it is reapeating the
address the correct number of times. Now what am I doing wrong?


Dim dbsCurrent As Database
Dim rstRecords As Recordset
Dim SendWhat As String

SendWhat = "SELECT llListingID, pbeMailAddress FROM qryBuyerByCounty WHERE
(llListingID)= " & Forms!frmSendeMailToMatchedBuyers!txtListingID & ";"

Set dbsCurrent = CurrentDb()
Set rstRecords = dbsCurrent.OpenRecordset(SendWhat, dbOpenDynaset,
dbSeeChanges, dbOptimistic)

With rstRecords
Do Until .EOF
txtTo = txtTo & pbeMailAddress & ";"
.MoveNext
Loop
End With


Thanks,
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II
 
G

Gina Whipp

Why is it always the littel things????

Big THANKS Bob, alls right in the world!
 
6

'69 Camaro

Gina Whipp said:
My Loop is only getting the first eMail address though it is reapeating
the address the correct number of times. Now what am I doing wrong?

Do you have Option Explicit set in every code module and are you compiling
the code before running it?

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
6

'69 Camaro

Hi, Gina.
Bob hit the nail on the head but THANKS anyway!

Yes. I can see that. But I also see a potential problem that isn't readily
apparent if your code is running on a bound form. Therefore, I asked
whether or not you have Option Explicit set on every module in your database
and whether or not you are compiling the code before you run it.

Do you and are you?

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
G

Gina Whipp

I ALWAYS have Option Explicit. And I ALWAYS compile. Also of note, is that
that code runs on an unbound form. Key fields are filled from another open
form.
 
6

'69 Camaro

G

Gina Whipp

After you asked the question, I went and looked and see that I left out
VALUABLE, critical, need to know information! :-o
 

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

Similar Threads


Top