I can get the Emails to gerenate as I want them, but in order to send them, I need to go to each email and manually send it. I know in the past I was able to send with our seeing the emails, but that was awhile ago. I am using MS Access 2003 amd Lotus notes 8.5.1
Here is the code I am using:
strSQL = "Select * " _
& "From tblBankAccountNumbers " _
& "Where (((tblBankAccountNumbers.BankName)=""Wells Fargo"") AND " _
& "((tblBankAccountNumbers.Contacts) Is Not Null))"
rst.Open strSQL
'Opens record set containing data existing in both the Text file and the Payroll Bank Data table
Do Until rst.EOF
CurrentDb.QueryDefs.Delete "qryDailyWellsData"
strSQL = "Select [As-Of Date], [As-Of-Time], [Bank ID], [Bank Name], State, [Acct No], [Acct Type], [Acct Name], " _
& "Currency, IBN, [BAI Type Code], [Tran Desc], [Debit Amt], [Credit Amt], [0 Day Flt Amt], [1 Day Flt Amt], " _
& "[2+ Day Flt Amt], [Customer Ref No], [Value Date], Location, [Bank Reference], [Tran Status], " _
& "[DescriptiveText1] & [DescriptiveText2] & [DescriptiveText3] & [DescriptiveText4] & [DescriptiveText5] & " _
& "[DescriptiveText6] & [DescriptiveText7] AS DescriptiveText " _
& "FROM txtWells " _
& "WHERE (((txtWells.[Acct No])='" & rst("BankAccount#") & "'))"
Set QryDef = CurrentDb.CreateQueryDef("qryDailyWellsData", strSQL)
'Delete and recreate query for account
ETo = rst("Contacts")
Subject = "Wells Bank prior day data for " & Format(Date, "mm/dd/yyyy")
Msg = "Here is your prior day bank data for Account " & rst("BankAccount#") & ". Please use " _
& "this date instead of pulling the data from Wells Fargo CEO. Please let me know if this is helpful. " _
& "Thank you"
DoCmd.SendObject acSendQuery, "qryDailyWellsData", acFormatXLS, ETo, , , Subject, Msg, False
rst.MoveNext
Loop
Here is the code I am using:
strSQL = "Select * " _
& "From tblBankAccountNumbers " _
& "Where (((tblBankAccountNumbers.BankName)=""Wells Fargo"") AND " _
& "((tblBankAccountNumbers.Contacts) Is Not Null))"
rst.Open strSQL
'Opens record set containing data existing in both the Text file and the Payroll Bank Data table
Do Until rst.EOF
CurrentDb.QueryDefs.Delete "qryDailyWellsData"
strSQL = "Select [As-Of Date], [As-Of-Time], [Bank ID], [Bank Name], State, [Acct No], [Acct Type], [Acct Name], " _
& "Currency, IBN, [BAI Type Code], [Tran Desc], [Debit Amt], [Credit Amt], [0 Day Flt Amt], [1 Day Flt Amt], " _
& "[2+ Day Flt Amt], [Customer Ref No], [Value Date], Location, [Bank Reference], [Tran Status], " _
& "[DescriptiveText1] & [DescriptiveText2] & [DescriptiveText3] & [DescriptiveText4] & [DescriptiveText5] & " _
& "[DescriptiveText6] & [DescriptiveText7] AS DescriptiveText " _
& "FROM txtWells " _
& "WHERE (((txtWells.[Acct No])='" & rst("BankAccount#") & "'))"
Set QryDef = CurrentDb.CreateQueryDef("qryDailyWellsData", strSQL)
'Delete and recreate query for account
ETo = rst("Contacts")
Subject = "Wells Bank prior day data for " & Format(Date, "mm/dd/yyyy")
Msg = "Here is your prior day bank data for Account " & rst("BankAccount#") & ". Please use " _
& "this date instead of pulling the data from Wells Fargo CEO. Please let me know if this is helpful. " _
& "Thank you"
DoCmd.SendObject acSendQuery, "qryDailyWellsData", acFormatXLS, ETo, , , Subject, Msg, False
rst.MoveNext
Loop