bigmaxnosauce
Registered User.
- Local time
- Today, 15:00
- Joined
- Nov 14, 2002
- Messages
- 12
Email Problem, HELP!!!!!!!
Hi,
I have a form that sends emails for various things, this was working for about 6-10 months, and recently it started not working for no reason that I could think of. When I run it, the first report gets sent and then it stops, it doesn't crash the program it just stops,
Here is the Code,
Private Sub Form_Open(Cancel As Integer)
Dim I As Integer
Dim AppExcel As Outlook.Application
I = 0
DoCmd.SendObject acSendReport, "Order Open", "*.snp", "", , , "Open Order Report", , strMessage, False
DoCmd.SendObject acSendReport, "Order BoardEmail", "*.snp", "", , , "Order Board", , strMessage, False
Set rstform = CurrentDb.OpenRecordset("ManEmail")
Set strMn = rstform.[ManagerName]
rstform.MoveFirst
Do While Not rstform.EOF
If I = 0 Then
Me.Manager = strMn
strEM = DLookup("Email", "Employees", "[RepName] = """ & Me.Manager & """")
DoCmd.SendObject acSendReport, "Order BoardEmailMan", "*.snp", strEM, , , "Order Board", , strMessage, False
I = I + 1
Else
End If
If strMn <> Me.Manager And I = 1 Then
Me.Manager = strMn
strEM = DLookup("Email", "Employees", "[RepName] = """ & Me.Manager & """")
DoCmd.SendObject acSendReport, "Order BoardEmailMan", "*.snp", strEM, , , "Order Board", , strMessage, False
I = I + 1
Else
End If
If strMn <> Me.Manager And I = 2 Then
Me.Manager = strMn
strEM = DLookup("Email", "Employees", "[RepName] = """ & Me.Manager & """")
DoCmd.SendObject acSendReport, "Order BoardEmailMan", "*.snp", strEM, , , "Order Board", , strMessage, False
I = I + 1
Else
End If
rstform.MoveNext
Loop
If Weekday(Now()) = 3 Or Weekday(Now()) = 5 Then
Else
DoCmd.SendObject acSendReport, "TPO", "*.snp", "", "", "", "Third Party Awaiting Payment Report", , strMessage, False
End If
Set AppExcel = GetObject(, "Outlook.Application")
AppExcel.Quit
Set AppExcel = Nothing
Application.Quit
End Sub
Hi,
I have a form that sends emails for various things, this was working for about 6-10 months, and recently it started not working for no reason that I could think of. When I run it, the first report gets sent and then it stops, it doesn't crash the program it just stops,
Here is the Code,
Private Sub Form_Open(Cancel As Integer)
Dim I As Integer
Dim AppExcel As Outlook.Application
I = 0
DoCmd.SendObject acSendReport, "Order Open", "*.snp", "", , , "Open Order Report", , strMessage, False
DoCmd.SendObject acSendReport, "Order BoardEmail", "*.snp", "", , , "Order Board", , strMessage, False
Set rstform = CurrentDb.OpenRecordset("ManEmail")
Set strMn = rstform.[ManagerName]
rstform.MoveFirst
Do While Not rstform.EOF
If I = 0 Then
Me.Manager = strMn
strEM = DLookup("Email", "Employees", "[RepName] = """ & Me.Manager & """")
DoCmd.SendObject acSendReport, "Order BoardEmailMan", "*.snp", strEM, , , "Order Board", , strMessage, False
I = I + 1
Else
End If
If strMn <> Me.Manager And I = 1 Then
Me.Manager = strMn
strEM = DLookup("Email", "Employees", "[RepName] = """ & Me.Manager & """")
DoCmd.SendObject acSendReport, "Order BoardEmailMan", "*.snp", strEM, , , "Order Board", , strMessage, False
I = I + 1
Else
End If
If strMn <> Me.Manager And I = 2 Then
Me.Manager = strMn
strEM = DLookup("Email", "Employees", "[RepName] = """ & Me.Manager & """")
DoCmd.SendObject acSendReport, "Order BoardEmailMan", "*.snp", strEM, , , "Order Board", , strMessage, False
I = I + 1
Else
End If
rstform.MoveNext
Loop
If Weekday(Now()) = 3 Or Weekday(Now()) = 5 Then
Else
DoCmd.SendObject acSendReport, "TPO", "*.snp", "", "", "", "Third Party Awaiting Payment Report", , strMessage, False
End If
Set AppExcel = GetObject(, "Outlook.Application")
AppExcel.Quit
Set AppExcel = Nothing
Application.Quit
End Sub