By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,575 Members | 1,377 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,575 IT Pros & Developers. It's quick & easy.

SendObject in Access2K works sporadically

P: n/a
Sam
The db I use has code (below) to send an email to an individual, based
on the completion of an action with the record. This many happen for
one record at a time, or 25 records at a time, some sequential, some
not.

Problem is it only works sometimes. Generally, if I try to use it on a
second record in a series, it LOOKS like it is working (the status bar
in the lower left says "calculating..." then returns to form view), but
does not actually DO the process. But sometimes it works flawlessly for
any number of record updates, and then stops working with no indication
of a problem. And there is no telling when it will work and when it
won't. It doesn't throw a debug at me and I have to close the db to be
able to get it to work.

I am not SQL savvy enough to figure what is or isn't working. Any
ideas?

Thanx,
Sam

CODE
Private Sub chkspvsr_Click()
On Error GoTo Err_chkspvsr_Click

Dim CHK As Integer
Dim BNum As Variant
Dim Client As String
Dim email As String
Dim DScrip As Variant
DScrip = Me!Descr
BNum = Me!txtBCRNum
Client = Me!txtClientName
CHK = Me!chkspvsr

If CHK = -1 Then
Me!lblMsg.Visible = True

DoCmd.SendObject , , acFormatTXT, "Us*******@Company.com", , , "BCR
# '" & _
BNum & "' for '" & Client & "' is TESTED and COMPLETE.",
"DESCRIPTION OF CHANGE - " & DScrip
Me!lblMsg.Visible = False
Else: Exit Sub
End If

Exit_chkspvsr_Click:
Exit Sub

Err_chkspvsr_Click:
Me!lblMsg.Visible = False
MsgBox Err.Description
Resume Exit_chkspvsr_Click
End Sub

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
So you change the Sub to a Function and make the return value a
Boolean. At the top of the function, you declare the default value to
false. If the mail sends, you set it to true. In the error trapping,
you set it to false. Then if the function returns False, you do
something - flag the record, write the failure to a table, whatever.

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.