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

  • Thread starter Thread starter Bob Quintal
  • Start date Start date
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
 
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
 
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.
 
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.
 
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.
 
After you asked the question, I went and looked and see that I left out
VALUABLE, critical, need to know information! :-o
 
Back
Top