SQL help - Query output as CSV (1 Viewer)

davegillian

New member
Local time
Today, 12:12
Joined
Apr 13, 2006
Messages
9
Hi,

I have a select query that selects certain customer email addresses and
I want to output the results as csv, which can be used directly in a "To:" field to create a group email.

The SQL of my query is:

SELECT [Customer Details].[Email Address]
FROM [Customer Details] INNER JOIN [Orders] ON [Customer Details].[Customer ID] = [Orders].[Customer ID]
WHERE ((([Orders].[Licence Declaration])=No) AND (([Orders].[Licence Status])="Unlicensed"));

I have found some SQL code on the internet as follows:

"SELECT Field1, field2 FROM table WHERE field1='" & [FORM]![PARAMETER] & "';"

but adapting my code with that is a little bit beyond me...can anyone help?!

Cheers,

Dave
 

Michael J Ross

Registered User.
Local time
Today, 12:12
Joined
Mar 2, 2006
Messages
245
You can create a csv file of results for your existing query by right clicking on the query name in the queries window and choosing Export and choosing Text Files as in the Save As Type.
 

davegillian

New member
Local time
Today, 12:12
Joined
Apr 13, 2006
Messages
9
Michael J Ross said:
You can create a csv file of results for your existing query by right clicking on the query name in the queries window and choosing Export and choosing Text Files as in the Save As Type.

Thanks for your reply. I was hoping to do this automatically through VB code, SQL or a macro. The DB will be used by non-computer literate users so I want to be able to get the query result as a field containing csv email addresses, this would be displayed on a form and a private sub would take the data on the form and use it as the "To:" part of the send object. That way I don't have to place trust on the user to export, copy & paste etc because invariably it gets messed up!
 

namliam

The Mailman - AWF VIP
Local time
Today, 13:12
Joined
Aug 11, 2003
Messages
11,695
If you are using Outlook you can automate opening a mail and putting in the email addresses directly there.... Search the forum and you will find some samples out there.
 

Users who are viewing this thread

Top Bottom