Advertisement
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.
Your Input Matters 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! |
||
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
|