MS Access remains in Task Manager after closing



Good morning, all.....
Here is the problem: the main form's Dos...Loops have all
been terminated with an Exit Do command (as was advised on
this type of problem). But I have another form that
retrieves all the customers e-mails or certain e-mails
based on the product that these customers subscribe to.
In this form, I use Do...Loop to loop through all the
records to obtain all these e-mails. If I put a Exit Do
as shown below, it will only return one e-mail address,
but if I put the Exit Do, Access won't remain in the Task
Manager (most of the times, but sometimes it does). Does
anyone has an idea? Thanks

Private Sub cmdAllEmails_Click()
'Displays customers e-mails and enable the Send button
cboTitles.Value = "All Customers' e-Mails"
cmdDisplayEMails_SB.Enabled = False
Dim mySub, mySubcode, sql, addresses, Address As String
Dim rst, rstTemp As Recordset

Dim dbs As DAO.Database
Set dbs = CurrentDb

sql = "SELECT CustomerDB.[E-mail Address], CustomerDB.
[Alternate E-mail Address] FROM CustomerDB"

Set rst = dbs.OpenRecordset(sql)

Do While Not rst.EOF
If rst![E-mail Address] <> "" Then
Address = rst![E-mail Address]
addresses = Address & ";" & addresses
Exit Do
End If


txtEmailAddress.Value = addresses

cmdSend.Enabled = True

End Sub


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