Advertisement

05.25.2008 at 01:46PM PDT, ID: 23431595
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.6

Create attach and send pipe delimited Text File

Asked by ckangas7 in Access Coding/Macros, VB Script

Tags: , , ,

I have the attached code in Access 2003 VB which which creates a record set, loops through it and creates and sends excel spreadsheets as email attachments.  The excel attachements are created from a query.  It works nicely.  Only thing I need to change is that attachments  need to be in pipe delimited text format.  The tranfertext command will create the file I want :

DoCmd.TransferText acExportDelim, "sparstoreex", "Temp_Store", "C:\Central Billing\Export\Stores\Spartan\" & rs(0) & "-" & Replace(rs(1), "/", "-") & ".txt"

But there does not seem to be a way to then use the SendObject command to send that file as an email attachment.  How can I do what I want to do?
 Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
Public Sub email_all_Spartan_Store()
Dim strSQL As String
Dim strQRY
Dim rs As DAO.Recordset
Dim tmpstore As QueryDef
strSQL = "SELECT DISTINCT t_psd_imports.Store_id, max(date), max(t_stores.store_name),max(t_stores.store_email) FROM t_psd_imports INNER JOIN t_stores On t_stores.store_id = t_psd_imports.store_id where record_type =" & Chr(34) & "DC" & Chr(34) & " GROUP BY t_psd_imports.store_id"
Set rs = CurrentDb.OpenRecordset(strSQL)
rs.MoveFirst
Do Until rs.EOF
strQRY = "SELECT " & Chr(34) & "Reverse Vending" & Chr(34) & " AS Partner_ID," & Chr(34) & "L" & Chr(34) & " AS Record_Type, DatePart('yyyy',t_psd_imports.date) &" & Chr(34) & "-" & Chr(34) & " & DatePart('ww',t_psd_imports.date) AS [Invoice Number],"
strQRY = strQRY & "t_psd_imports.date AS [Invoice Date]," & Chr(34) & "AP" & Chr(34) & "AS [AP/BI Flag]," & Chr(34) & "" & Chr(34) & "AS Blank_1,"
strQRY = strQRY & Chr(34) & "" & Chr(34) & "AS Blank_2, " & Chr(34) & "" & Chr(34) & "  AS Blank_3," & Chr(34) & "" & Chr(34) & " AS Blank_4," & Chr(34) & "" & Chr(34) & " AS Blank_5, " & Chr(34) & "" & Chr(34) & "AS Blank_6, " & Chr(34) & "" & Chr(34) & " AS Blank_7, Sum(t_psd_imports.container_qty) AS Quantity, " & Chr(34) & "" & Chr(34) & " AS Blank_8, "
strQRY = strQRY & "Sum(t_psd_imports.container_qty)*Max(t_stores.Deposit) AS Extended_Cost," & Chr(34) & "" & Chr(34) & "AS Blank_9," & Chr(34) & "" & Chr(34) & "AS Blank_10," & Chr(34) & "" & Chr(34) & "AS Blank_11," & Chr(34) & "" & Chr(34) & "AS Blank_12," & Chr(34) & "" & Chr(34) & "AS Blank_13," & Chr(34) & "" & Chr(34) & "AS Blank_14, t_stores.spartan_id AS GL_Dept_ID," & Chr(34) & "" & Chr(34) & "AS Blank_15," & Chr(34) & "" & Chr(34) & "AS Blank_17,"
strQRY = strQRY & Chr(34) & "" & Chr(34) & "AS Blank_18," & Chr(34) & "" & Chr(34) & "AS Blank_19," & Chr(34) & "0" & Chr(34) & " & t_psd_imports.distributor_id AS [Addl Ref Field 1], " & Chr(34) & "" & Chr(34) & "AS Blank_20," & Chr(34) & "" & Chr(34) & "AS Blank_21," & Chr(34) & "" & Chr(34) & "AS Blank_22," & Chr(34) & "" & Chr(34) & "AS Blank_23," & Chr(34) & "" & Chr(34) & "AS Blank_24," & Chr(34) & "" & Chr(34) & "AS Blank_25," & Chr(34) & "" & Chr(34) & "AS Blank_26,"
strQRY = strQRY & Chr(34) & "" & Chr(34) & "AS Blank_27," & Chr(34) & "" & Chr(34) & "AS Blank_28"
strQRY = strQRY & " FROM t_stores INNER JOIN (t_distributors INNER JOIN t_psd_imports ON t_distributors.distributor_id=t_psd_imports.distributor_id) ON t_stores.store_id=t_psd_imports.store_id"
strQRY = strQRY & " WHERE t_psd_imports.record_type='DC' AND"
strQRY = strQRY & " t_psd_imports.store_id = "
strQRY = strQRY & Chr(34) & rs(0) & Chr(34) & "GROUP BY t_psd_imports.date," & Chr(34) & "0" & Chr(34) & " & t_psd_imports.distributor_id, t_stores.spartan_id"
'MsgBox strQRY
attachf = rs(0) & "-" & Replace(rs(1), "/", "-")
Set tmpstore = CurrentDb.CreateQueryDef(attachf, strQRY)
DoCmd.SendObject acSendQuery, attachf, acFormatXLS, _
    rs(3), , , _
    "Store Report for " & rs(2), "Here is your report for the week.", False
DoCmd.DeleteObject acQuery, attachf
rs.MoveNext
Loop
 
Set rs = Nothing
End Sub
[+][-]05.25.2008 at 02:39PM PDT, ID: 21643724

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.25.2008 at 05:03PM PDT, ID: 21644042

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.25.2008 at 05:06PM PDT, ID: 21644051

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, VB Script
Tags: Microsoft, Access, 2003, vbz
Sign Up Now!
Solution Provided By: boag2000
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.25.2008 at 05:14PM PDT, ID: 21644068

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.25.2008 at 05:15PM PDT, ID: 21644071

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.25.2008 at 05:41PM PDT, ID: 21644130

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628