Trevor
01-24-2008, 01:25 PM
Hi,
I am looping through an Rst to display all the email addresses in a table and it is only displaying the first, last or no record at all depending if I use .MoveFirst, .Moveprevious, .Movelast, .MoveNext
and if I Comment out the move statment the event hangs and have to manualy close access, if I uses .Movelast,.MoveFirst. the event also hangs , If I replace the Do Until .EOF to .BOF I get error no record. Here is my code; please help
Dim loDb As DAO.Database
Dim loRst As DAO.Recordset
Set loDb = CurrentDb
Set loRst = loDb.OpenRecordset("QryUnitEmailAddress")
With loRst
Do Until .EOF
SendToo = .Fields("Email") & ""
.MoveNext
Loop
End With
loRst.Close
Set loRst = Nothing
Set loDb = Nothing
EditMessage = 1
SendTo = SendToo
stSubject = "test"
stBody = "Hello"
DoCmd.SendObject , , acFormatTXT, SendTo, , also, stSubject, stBody, 1
End Sub
I am looping through an Rst to display all the email addresses in a table and it is only displaying the first, last or no record at all depending if I use .MoveFirst, .Moveprevious, .Movelast, .MoveNext
and if I Comment out the move statment the event hangs and have to manualy close access, if I uses .Movelast,.MoveFirst. the event also hangs , If I replace the Do Until .EOF to .BOF I get error no record. Here is my code; please help
Dim loDb As DAO.Database
Dim loRst As DAO.Recordset
Set loDb = CurrentDb
Set loRst = loDb.OpenRecordset("QryUnitEmailAddress")
With loRst
Do Until .EOF
SendToo = .Fields("Email") & ""
.MoveNext
Loop
End With
loRst.Close
Set loRst = Nothing
Set loDb = Nothing
EditMessage = 1
SendTo = SendToo
stSubject = "test"
stBody = "Hello"
DoCmd.SendObject , , acFormatTXT, SendTo, , also, stSubject, stBody, 1
End Sub