Sending emails until EOF (1 Viewer)

lucy1216

Registered User.
Local time
Today, 09:14
Joined
Feb 28, 2013
Messages
11
First of all, to whomever reads and/or responds I thank you for your patience.
I am using Access 2010/Outlook 2010 32bit
I am relatively new to VBA and I am completely lost on how to accomplish the following:
My database was built to facilitate approvals for accounts payable.
My issue now is that I want to create a command button that sends out reminders using outlook.
To make it simplistic, here is what I have:
tblReceiveTemp-This table holds the following fields:
ID-Key, Level 1Approver, Level 1Approver Email, Status, ATT, Sprint, USA, Verizon, ATTReceiveStatus, SprintReceiveStatus, USAReceiveStatus, VerizonReceiveStatus
ReminderOne = rptReminderOne
ReminderTwo=rptReminderTwo
ReminderThree=rptReminderThree
tblEmailOutgoing-This table holds the following fields:
ID-Key, ApproverName, ATTNotificationBill, ATTReminderOne, ATTReminderTwo, ATTReminderThree, SprintNotificationBill, SprintReminderOne, SprintReminderTwo, SprintReminderThree, USANotificationBill, USAReminderOne, USAReminderTwo, USAReminderThree, VerizonNotificationBill, VerizonReminderOne, VerizonReminderTwo, VerizonReminderThree, COBDate
qryATTNotReceived –
SELECT tblReceiveTemp.ATTReceiveStatus, tblReceiveTemp.[Level 1Approver Email] AS Email, tblReceiveTemp.[Level 1Approver]
FROM tblReceiveTemp
WHERE (((tblReceiveTemp.ATTReceiveStatus)="NR"));
qrySprintNotReceived –
SELECT tblReceiveTemp.SprintReceiveStatus, tblReceiveTemp.[Level 1Approver Email] AS Email, tblReceiveTemp.[Level 1Approver]
FROM tblReceiveTemp
WHERE (((tblReceiveTemp.SprintReceiveStatus)="NR"));
qryUSANotReceived-
SELECT tblReceiveTemp.USAReceiveStatus, tblReceiveTemp.[Level 1Approver Email] AS Email, tblReceiveTemp.[Level 1Approver]
FROM tblReceiveTemp
WHERE (((tblReceiveTemp.USAReceiveStatus)="NR"));
qryVerizonNotReceived-
SELECT tblReceiveTemp.VerizonReceiveStatus, tblReceiveTemp.[Level 1Approver Email] AS Email, tblReceiveTemp.[Level 1Approver]
FROM tblReceiveTemp
WHERE (((tblReceiveTemp.VerizonReceiveStatus)="NR"));

So here is basically what I want to do and I need a lot of assistance with this code:

Reminder One:

If tblReceiveTemp.’Vendor’ReciveStatus, = “NR”
THEN sendobject “rptReminderOne” to all persons in qry’Vendor’NotReceived until EOF
Update tblEmailOutgoing.’Vendor”ReminderOne = Now()

**’Vendor’ is a placeholder for ATT, Sprint and Verizon.

Reminder Two:

If tblReceiveTemp.ATTReceiveStatus = “NR” and tlbEmailOutgoing.ReminderOne is not null
Then sendobject “rptReminderTwo” to all persons in qry’Vendor’NotReceived until EOF
Update tblEmailOutgoing.’Vendor’ReminderTwo = Now()

Reminder Three:
If tblReceiveTemp.ATTReceiveStatus = “NR” and tlbEmailOutgoing.ReminderTwo is not null
Then sendobject “rptReminderThree” to all persons in qry’Vendor’NotReceived until EOF
Update tblEmailOutgoing.’Vendor’ReminderThree = Now()

Basically all I need assistance with is setting up the code to send the emails. In addition, I need to verify that I have all of the correct references check in the code window.

Thanks again.





 

Catalina

Registered User.
Local time
Today, 09:14
Joined
Feb 9, 2005
Messages
462
Please use the Code Tags when posting code, this is so hard to read.
 

lucy1216

Registered User.
Local time
Today, 09:14
Joined
Feb 28, 2013
Messages
11
So sorry, where do I find information on using code tags?
 

pr2-eugin

Super Moderator
Local time
Today, 17:14
Joined
Nov 30, 2011
Messages
8,494
Check out this thread.. "Please Use CODE tags when posting VBA Code"..

Also make sure you properly indent the code.. The following..
Code:
Public Function SelectAll(lst As ListBox) As Boolean
On Error GoTo Err_Handler
[COLOR=Green]'Purpose:   Select all items in the multi-select list box.
'Return:    True if successful
'Author:    Allen Browne. http://allenbrowne.com  June, 2006.[/COLOR]
Dim lngRow As Long

If lst.MultiSelect Then
For lngRow = 0 To lst.ListCount - 1
lst.Selected(lngRow) = True
Next
SelectAll = True
End If

Exit_Handler:
Exit Function

Err_Handler:
Call MsgBox(Err.Number & Chr(10) & Err.Description & Chr(10) & "SelectAll()")
Resume Exit_Handler
End Function
Is as bad as..

Public Function SelectAll(lst As ListBox) As Boolean
On Error GoTo Err_Handler
'Purpose: Select all items in the multi-select list box.
'Return: True if successful
'Author: Allen Browne. http://allenbrowne.com June, 2006.

Dim lngRow As Long

If lst.MultiSelect Then
For lngRow = 0 To lst.ListCount - 1
lst.Selected(lngRow) = True
Next
SelectAll = True
End If

Exit_Handler:
Exit Function

Err_Handler:
Call MsgBox(Err.Number & Chr(10) & Err.Description & Chr(10) & "SelectAll()")
Resume Exit_Handler
End Function

Properly indented code,
Code:
Public Function SelectAll(lst As ListBox) As Boolean
On Error GoTo Err_Handler
[COLOR=Green]    'Purpose:   Select all items in the multi-select list box.
    'Return:    True if successful
    'Author:    Allen Browne. http://allenbrowne.com  June, 2006.[/COLOR]
    Dim lngRow As Long

    If lst.MultiSelect Then
        For lngRow = 0 To lst.ListCount - 1
            lst.Selected(lngRow) = True
        Next
        SelectAll = True
    End If

Exit_Handler:
    Exit Function

Err_Handler:
    Call MsgBox(Err.Number & Chr(10) & Err.Description & Chr(10) & "SelectAll()")
    Resume Exit_Handler
End Function
 
Last edited:

CJ_London

Super Moderator
Staff member
Local time
Today, 17:14
Joined
Feb 19, 2013
Messages
16,607
@Paul - do you mean intend or indent?
 

pr2-eugin

Super Moderator
Local time
Today, 17:14
Joined
Nov 30, 2011
Messages
8,494
@Paul - do you mean intend or indent?
Yes CJ, I did mean indent..


Getting back at me are we.. Just kidding mate.. ;) Have corrected my error, thanks.
 

Users who are viewing this thread

Top Bottom