Hello everyone, hope someone can help. I've got the following code running within my program, supplied gratefully by another member on the forum, I would like to adjust the code slightly, but I don't know how, here's the code:
Private Sub Command165_Click()
Dim rst As DAO.Recordset
Dim stSQL As String
Dim stTO As String
stSQL = "clients"
Set rst = CurrentDb.OpenRecordset(stSQL)
With rst
.MoveFirst
Do While Not .EOF
If .Fields("E-Mail Address") <> "" Then
stTO = stTO & IIf(stTO <> "", ";", "") & .Fields("E-Mail Address")
End If
.MoveNext
Loop
End With
DoCmd.SendObject acSendNoObject, , , , , stTO, "Information Requested", , True
End Sub
Now, what I need to do is if I apply a filter to the form that I'm on which has the command button to run this code, I would like the code to access the filtered records only, OK? I think it's got something to do with code with 'forms!clients.filter' in it.
Hope to hear from someone soon.
Private Sub Command165_Click()
Dim rst As DAO.Recordset
Dim stSQL As String
Dim stTO As String
stSQL = "clients"
Set rst = CurrentDb.OpenRecordset(stSQL)
With rst
.MoveFirst
Do While Not .EOF
If .Fields("E-Mail Address") <> "" Then
stTO = stTO & IIf(stTO <> "", ";", "") & .Fields("E-Mail Address")
End If
.MoveNext
Loop
End With
DoCmd.SendObject acSendNoObject, , , , , stTO, "Information Requested", , True
End Sub
Now, what I need to do is if I apply a filter to the form that I'm on which has the command button to run this code, I would like the code to access the filtered records only, OK? I think it's got something to do with code with 'forms!clients.filter' in it.
Hope to hear from someone soon.