Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

transferring email to the notepad with a semicolon delimiter 1

Status
Not open for further replies.

davikokar

Technical User
May 13, 2004
523
IT
Hallo,
I'm trying to export the email adresses to a txt file with a semicolon delimiter. What i have by now is the the list of the email adresses but all in quotes and delimited with new line. This result from this code:

DoCmd.TransferText acExportDelim, , "qry_SearchResult_EmailExtractor", "C:\email.txt", 0
Call Shell("NOTEPAD.exe c:\email.txt", 1)

The ideal output would be the list of email delimited by semicolon on one single long row. Does someone have an idea?
thanks for suggestions
 
Have you tried to play with a Recordset based on your qry_SearchResult_EmailExtractor query ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
mmm... I will try this way too, but I was close to the solution with the transfertext one, where i got stucked is the export specification. I know there is a wizard that would set up your export specification where you can choose at least a delimiter. The problem is that my query is based on another query which is based on few unbound combo on a form (i think is called parameter query). Then when I launch the wizard for the specifications it will tell me "Too few parameter. Expected 11" (11 combos). Is there a way to set export specification for a parameter query or it's better to forget all of this and start with the recordset...?
 
PHV,
I was trying your solution but actually I get stucked with the same problem: the recordset won't open because the query is based on a form (I get the same message: too few parameters. Expected 11). The strange fact is that when I run the code the form is open and the combos have all a selection. So how can I tell to get the parameters there?...



 
If ac 2k or above you may consider something like this:
strFile = "C:\email.txt"
DoCmd.TransferText acExportDelim, , "qry_SearchResult_EmailExtractor", strFile, 0
Const ForReading = 1, ForWriting = 2
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso_OpenTextFile(strFile, ForReading)
strEmails = f.ReadAll
f.Close
strEmails = Replace(Replace(strEmails, Chr(34), ""), vbCrLf, ";")
Set f = fso_OpenTextFile(strFile, ForWriting, True)
f.WriteLine strEmails
f.Close
Set f = nothing
Set fso = Nothing

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV, thanks a lot for your help. I still have to understand exactly the code but it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top