HELP Email from Access..

KaiProton

Registered User.
Local time
Today, 20:29
Joined
Jan 22, 2005
Messages
35
Help,

Internally to our Company we issue forms that need filling in by the factory,

this form was always done my filling out one at a time every time it was needed and then emailing ppl in the company that needs to know whats going on,
so I automated it in Access, through some code I found in here,
it worked great for about 2 hours then stopped running, I cannot figure out why, can anyone help.


Here is the Code:

Private Sub Cmd_PrintMPT_Click()
On Error GoTo Err_Cmd_PrintMPT_Click

Dim stDocName, Pn As String, chimps As Integer
Dim namer, stLinkCriteria As String
Partnumber.SetFocus
Pn = Partnumber.Text
Crimps.SetFocus
chimps = Crimps.Value

If Issued.Value = False Then
'Issued.Value = True
If chimps = 2 Then
stDocName = "Rpt_2CrimpIssue"
ElseIf chimps = 3 Then
stDocName = "Rpt_3CrimpIssue"
ElseIf chimps = 4 Then
stDocName = "Rpt_4CrimpIssue"
End If

DoCmd.OpenReport stDocName, acPreview

DoCmd.RunCommand acCmdPrint

DoCmd.Close

'Email Stuff
stDocName = "Frm_emailssub"
DoCmd.OpenForm stDocName, , , stLinkCriteria
'DoCmd.GoToRecord , , acFirst

Do While namer <> "End"
namer = Forms!Frm_EmailsSUB!PMail.Value

If namer = "End" Then Exit Do


MsgBox namer
DoCmd.SendObject _
, _
, _
, _
namer, _
, _
, _
"Mass Production Trial Sheet!", _
"Another MPT Sheet has been Issued on Yellow C.Card." + Chr(13) + "Partnumber: " + Pn, _
False

DoCmd.GoToRecord , , acNext
Loop

DoCmd.Close

MsgBox "All Emails Sent!", vbInformation, "Email Confirmation"
Exit Sub

ElseIf Issued.Value = True Then
If MsgBox("The MPT for " + Pn + Chr(13) + "has already been Issued." + Chr(13) + Chr(13) + "Do you wish to Issue again?", vbExclamation + vbYesNo, "Double Issue") = vbNo Then
End
ElseIf 7 Then
If chimps = 2 Then
stDocName = "Rpt_2CrimpIssue"
ElseIf chimps = 3 Then
stDocName = "Rpt_3CrimpIssue"
ElseIf chimps = 4 Then
stDocName = "Rpt_4CrimpIssue"
End If

DoCmd.OpenReport stDocName, acPreview
DoCmd.RunCommand acCmdPrint
DoCmd.Close
MsgBox "Reprinting Does NOT Email", vbInformation, "No Mail"
End If
End
End If
Exit Sub


Exit_Cmd_PrintMPT_Click:
DoCmd.Close
Exit Sub

Err_Cmd_PrintMPT_Click:

'MsgBox Err.Description
Resume Exit_Cmd_PrintMPT_Click

End Sub
 
It might help if you could elaborate on this:
"worked great for about 2 hours then stopped running"
What doesn't run? Does it print? What troubleshooting have you done?
 
You'll have to be more specific at a guess. Have you tried debugging to see which part is failing? If so, let us know.
 
Debugging

It always printed, unless I REM the lines,
I was testin the Emails and it was fine, then stopped working when I finalized the code to run for users,

NOW then,

the only other debuggin I did was re add the msgbox at the on error, as you may have seen err.description line at the end was rem-ed out,

I figure it may report a problem, the reason I got rid of it to begin with was because it reported when the print was cancelled, as it brings it up so the user can choose printer,

when I added it back the code ran fine, PRINTED and EMAILED just as I wanted,

so taking a chance i took out the err.desc. line and its still working,


my thinking now is that Im running on a poor server.

Thanks for the help.
 

Users who are viewing this thread

Back
Top Bottom