How to connect to an open Query?

F

Frank Johnson

I am writing a small emailer for a retail application in access.
Anyways, using the OpenRecordSet I can send emails to an entire table or
query.

Example

'strSQL = "SELECT * FROM [main data]"
'Set rec = CurrentDb().OpenRecordset(strSQL)
'rec.MoveFirst
' DoCmd.SetWarnings False
'Do While rec.EOF = False
' DoCmd.SendObject acSendNoObject, , acFormatText, rec!Email, ,
, "This is the subject", "This is my message to you, you filthy
animal.", False
' strEmail = strEmail & rec!Email & ";"
' rec.MoveNext
'Loop


But what I would like to do, is open a query of my choosing and filter
it using the gui interface. Now, I would like to go to my email form and
select the open query which I have already queried on and use that data
for the email. Is this possible?

I could make the query a static name, but what would be the command to
set the CurrentDB to a currently opened filtered query?

Thanks
 

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

Top