Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 2046: 'SendObject isn't available now'

Status
Not open for further replies.

richard1458

Instructor
Oct 21, 2000
27
0
0
GB
The above error message is generated when my colleague clicks a button that runs a procedure that includes the SendObject command to send an email. An identical copy of the same database works fine on my computer - SendObject creates an email ready to send.
(When I say identical copy, the front end is the same, but the back end tables contain different data.)
We are both using Access 97, Outlook Express 5
Any suggestions?
- Richard
 
Richard,
Stupid question. Does your colleague have his email program turned on?

Scott
"Learn from others' mistakes. You could not live long enough to make them all yourself."
-- Hyman George Rickover (1900-86),
 
Seems to make no difference - mine works whether it is or not, hers doesn't regardless.
Also, if I copy my front and back end over to her machine and use those, I get the same behaviour.
I suspect a problem with Windows Messaging, but in the past this has generated its own error messages, rather than them appearing as Access ones.
Might try the Microsoft knowledge base
- Richard
 
You might want to avoid using Sendobject completely, as the new security patches make it next to impossible to use. I have resorted to calling a cmd line SMTP mailer, and have had great success with it. It is called BLAT and has been around for quite a while.
 
Thanks for this suggestion. Do you have any examples of the code you use to send an email from Access using your SMTP mailer? Can it handle attachments - specifically Reports in rich text format and attached files e.g. Word Documents?
- Richard
 
Sorry took so long to get back to you, have been away.

Blat emailer is a freebie, (do a Google Search) and allows attachments.

The call to email is
Function sendmail()
On Error GoTo sendmail_Err

Dim msg As String
Dim subj As String
Dim addr As String
Dim file As String

'addr - email address fully qualified
addr = "email@address.com"
'file - this is the report of the run
file = "c:\runlog.doc"
'msg file - should contain line - Attached is log file output
msg = "c:\msg.txt"
'subject line no spaces
subj = "MDB_COMPACT_LOG"

' send mail using Blat mailer
Call Shell("blat " & msg & " -to " & addr & " -subject " & subj & " -hostname maildaemon -attach " & file, 1)

s = "Delete * from tblFileNameHistory;"
DoCmd.SetWarnings False
DoCmd.RunSQL s
DoCmd.SetWarnings True

sendmail_Exit:
Exit Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top