acsendnoobject isn't functioning properly

This works
DoCmd.SendObject acSendReport, "Heyreport", acFormatRTF, strTo, strCC, strBCC, strSubject, strMsg, Val(0)
This doesn't
DoCmd.SendObject acSendNoObject, , "MS-DOS Text , strTo, strCC, strBCC, strSubject,strMsg, Val(0)

The NoObject line leaves me with an email window up and focus on the TO in the email.  The send report works fine.

Thanks
TimKestermontAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
flavoConnect With a Mentor Commented:
Tested and worked a treat

need to add a .Value  after myRs("EmailAddress")


Dim oAcct As GroupwareTypeLibrary.Account
Dim oApp As GroupwareTypeLibrary.Application
Dim oMsg As GroupwareTypeLibrary.Message
Dim Mydb As DAO.Database
Dim myRs As DAO.Recordset
'Create a new instance of GW for us to use in VBA
Set oApp = CreateObject("NovellGroupWareSession")
'Log in - note, you you dont have GW logged in, it will prompt with the usual login screen
' you can also use Set oAcct = oApp.Login("userName", "Password") if you want
Set oAcct = oApp.Login("", "")

'create a new email message for us to use
Set oMsg = oAcct.MailBox.Messages.Add

'as above
oMsg.Subject = "Subject - 0"
oMsg.BodyText = "Body Text"

Set Mydb = CurrentDb
Set myRs = Mydb.OpenRecordset("Email Addresses", dbOpenDynaset)
myRs.MoveFirst
   
  Do Until myRs.EOF
         oMsg.Recipients.Add myRs("EmailAddress").Value
         myRs.MoveNext
   Loop

oMsg.Send

'clean up our variables
Set oMsg = Nothing
Set oApp = Nothing
Set oAcct = Nothing
0
 
dannywarehamCommented:
DoCmd.SendObject acSendNoObject, , "MS-DOS Text , strTo, strCC, strBCC, strSubject,strMsg, Val(0)

won't work for two reasons:
Firstly, there's a speech mark
Secondly, the format MS-DOS Text is nt available.

If you type acFORMAT then press ctrl+space, a list of available formats will appear
0
 
dannywarehamCommented:
Scratch that:
acSendNoObject will just create a mail with no attachment - in which case the acFormat command becomes redundant.

0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
TimKestermontAuthor Commented:
This is how it originally started, my mistake
DoCmd.SendObject acSendNoObject, , "MS-DOS Text (*.txt)", strTo, strCC, strBCC, strSubject, strMsg, Val(0)

And is this what you are requesting
DoCmd.SendObject acSendNoObject, , acFormatTXT,strTo, strCC, strBCC, strSubject, strMsg, Val(0)
0
 
TimKestermontAuthor Commented:
This is where it stops everytime unless I use acsendreport or table etc..
DoCmd.SendObject acSendNoObject, , strTo, strCC, strBCC, strSubject, strMsg, Val(0)

0
 
dannywarehamCommented:
Rather than val(0), set is as false (to send automatically) and lose the TEXT format (this is the format of the attachment, not the mail)

DoCmd.SendObject acSendNoObject, , , strTo, strCC, strBCC, strSubject, strMsg, False

0
 
dannywarehamCommented:
The command:
DoCmd.SendObject acSendNoObject, , , strTo, strCC, strBCC, strSubject, strMsg, False

Works on mine no probs...
What it may be in your case is if strTo, strCC, or strBCC are not valid addresses, in SMTP format (ie...   Someone@somewhere.com)
0
 
TimKestermontAuthor Commented:
I just don't know because the reports and tables etc...run fine.  Only when I use the acsendnoobject.  I am using Groupwise as well.  But the emails blast off fine when reports and tables are being sent.  Don't get it
0
 
TimKestermontAuthor Commented:
Here is the complete code

Dim MyDb As Database
Dim MyRS As Recordset
Dim strTo As String
Dim strCC As String
Dim strBCC As String
Dim strMsg As String
Dim strSubject As String
Dim x As Variant
Set MyDb = CurrentDb
Set MyRS = MyDb.OpenRecordset("Email addresses", dbOpenDynaset)THIS IS THE TABLE

MyRS.MoveFirst
Do

strTo = MyRS("Email Address")THIS IS THE EMAIL FIELD
strMsg = "Message for Customer " & MyRS("name") "THIS IS THE NAME FIELD"
strSubject = "Billing Information Notice"
DoCmd.SendObject acSendNoObject, , "MS-DOS Text (*.txt)", strTo, strCC, strBCC, strSubject, strMsg, Val(0)
MyRS.MoveNext
Loop Until MyRS.EOF
MyRS.Close
MyDb.Close
0
 
dannywarehamCommented:
This is exactly what I have in my working example:

DoCmd.SendObject acSendNoObject, , , "daniel@some.com", , , , , Val(0)
**** Email address edited *****
Alan Warren
Page Ed (databases)
*************************
Do you have any broken references?
Check that you have Outlook 9.0 (or 10.0)
0
 
dannywarehamCommented:
Your code looks fine (providing the CAPS bits are prefixed with an apostrophy...)

Try losing the loop and testing just the send option first.
Then build up from that to the loop
You may also want to include some error handling in here too.
0
 
TimKestermontAuthor Commented:
I am not using outlook, but GroupWise

I lost the loop,  even with a simple DoCmd.SendObject acSendNoObject, , , Me.emailaddress it stops with the email open and the TO has focus

It has something to do with the acSendNoObject.  I tried your code the very same text and stopped with the email box open focus on the To.
0
 
dannywarehamCommented:
OK.
This may be the problem.
Access's built in command is for Outlook.
I've not used GroupWise myself, so can't offer any of my own advice.
Give me a second to do some hunting....

:-)
0
 
dannywarehamCommented:
OK:
This is from an old post:

I've gotten it (sendObject) to work with Access 97 and GroupWise version 5.2.  It's a bit of a pain in the neck, but here goes.  I think that generally you must get the SendObject to find GroupWise's mapi.dll.  This seems to work best when the last email program installed was GroupWise (there's probably an easier way to do that part.)  But the other part is that I needed was a kludgy utility from MS called the Form Switching utility (go to Knowledgebase and search Outlook for form switching -see the article and can download it see article #143477).  It's designed to switch between the slightly different Outlook and Exchange client form, but you need it to be set for Outlook for the sendobject to work with GroupWise.  I think that I found that last little nugget on the Novell knowledgebase (see article #2919555 for some other details).
0
 
dannywarehamCommented:
Another suggestion is to include "Do Events" in your code to slow it down and let GroupWise catch up.
0
 
dannywarehamCommented:
0
 
shanesuebsahakarnCommented:
Tim,

I would highly suggest avoiding SendObject. As you've discovered, it is buggy and unreliable. In addition to Danny's link, you might want to take a look here:
http://www.granite.ab.ca/access/email/novellgroupwise.htm
0
 
TimKestermontAuthor Commented:
what would you suggest in the auto send email using a form and button access db
0
 
flavoCommented:
docmd.sendobject works with Groupwise 5.5 and 6.0 (Have it at work)

Tim,

Could you get the Groupwise Automation code i posted  to work???
0
 
TimKestermontAuthor Commented:
I have GroupWise 6.5 on our network.  I know it's got to be something small but hidden.  It use to work like I said, as I stated in the other question, the GW code worked fine but wouldn't autosend nor could I figure out how to put the variables.

Thanks
0
 
flavoCommented:
I dont always..

can you take a look here Alan

http://www.experts-exchange.com/Databases/MS_Access/Q_21146965.html

posted Date: 09/28/2004 08:49AM EST

Dave
0
 
Alan WarrenApplications DeveloperCommented:
Hi Dave

you want I should fix that post with your cool replace string for you?

Alan
0
 
flavoCommented:
Tim

Set MyDb = CurrentDb
Set MyRS = MyDb.OpenRecordset("Email Addresses", dbOpenDynaset)
MyRS.MoveFirst
Do Until MyRS.EOF
sRecipient = sRecipient & ";" & MyRS("EmailAddress")

MyRS.MoveNext

Dave
0
 
TimKestermontAuthor Commented:
Thanks, I will try and give it a whirl tomorrow between backup and webstuff and everything else..I'm sure you know what I mean.  How does that read.  sRecipient & ";" & MyRS("EmailAddress")

In the Do until but where should I put the Loop?  I noticed if I put it  after the oMsg.send  I get the runtime error.  But before is where I had it. ""THIS IS YOUR CODE BELOW" by the way.

Dim oAcct As GroupwareTypeLibrary.Account
Dim oApp As GroupwareTypeLibrary.Application
Dim oMsg As GroupwareTypeLibrary.Message

'Create a new instance of GW for us to use in VBA
Set oApp = CreateObject("NovellGroupWareSession")
'Log in - note, you you dont have GW logged in, it will prompt with the usual login screen
' you can also use Set oAcct = oApp.Login("userName", "Password") if you want
Set oAcct = oApp.Login("", "")

'create a new email message for us to use
Set oMsg = oAcct.MailBox.Messages.Add

'as above
oMsg.Subject = "Subject - 0"
oMsg.BodyText = "Body Text"
oMsg.Recipients.Add sRecipient, , 0   '0 for To, 1 for CC, 2 for BCC
oMsg.Send

'clean up our variables
Set oMsg = Nothing
Set oApp = Nothing
Set oAcct = Nothing

0
 
flavoCommented:
Tim,

Dim oAcct As GroupwareTypeLibrary.Account
Dim oApp As GroupwareTypeLibrary.Application
Dim oMsg As GroupwareTypeLibrary.Message

'Create a new instance of GW for us to use in VBA
Set oApp = CreateObject("NovellGroupWareSession")
'Log in - note, you you dont have GW logged in, it will prompt with the usual login screen
' you can also use Set oAcct = oApp.Login("userName", "Password") if you want
Set oAcct = oApp.Login("", "")

'create a new email message for us to use
Set oMsg = oAcct.MailBox.Messages.Add

'as above
oMsg.Subject = "Subject - 0"
oMsg.BodyText = "Body Text"

Set MyDb = CurrentDb
Set MyRS = MyDb.OpenRecordset("Email Addresses", dbOpenDynaset)
MyRS.MoveFirst
Do Until MyRS.EOF
sRecipient = sRecipient & ";" & MyRS("EmailAddress")

MyRS.MoveNext

oMsg.Recipients.Add sRecipient, , 0  
oMsg.Send

'clean up our variables
Set oMsg = Nothing
Set oApp = Nothing
Set oAcct = Nothing


I have assumed they are all To, not CC or BCC

Dave
0
 
flavoCommented:
Oopps, forogt comments for you

'loop until we reach the end of the recordset
Do Until MyRS.EOF

'Append the records email address to the current string of Emails
'for example on the first time through the loop sRecipient would look like
' "someEmail@somewhere.com;"
' after the second loop with would look like
' "someEmail@somewhere.com;someOtherEmail@somewhereElse.com;"
sRecipient = sRecipient & ";" & MyRS("EmailAddress")

'move to the next record
MyRS.MoveNext

'should also add this line in tooo

'this line "chops" off the last ; that we dont really want
sRecipient = Left(sRecipient, Len(sRecipient) -1)
0
 
flavoCommented:
New code

Dim oAcct As GroupwareTypeLibrary.Account
Dim oApp As GroupwareTypeLibrary.Application
Dim oMsg As GroupwareTypeLibrary.Message

'Create a new instance of GW for us to use in VBA
Set oApp = CreateObject("NovellGroupWareSession")
'Log in - note, you you dont have GW logged in, it will prompt with the usual login screen
' you can also use Set oAcct = oApp.Login("userName", "Password") if you want
Set oAcct = oApp.Login("", "")

'create a new email message for us to use
Set oMsg = oAcct.MailBox.Messages.Add

'as above
oMsg.Subject = "Subject - 0"
oMsg.BodyText = "Body Text"

Set MyDb = CurrentDb
Set MyRS = MyDb.OpenRecordset("Email Addresses", dbOpenDynaset)
MyRS.MoveFirst
Do Until MyRS.EOF
sRecipient = sRecipient & ";" & MyRS("EmailAddress")
MyRS.MoveNext

sRecipient = Left(sRecipient, Len(sRecipient) -1)
oMsg.Recipients.Add sRecipient, , 0  
oMsg.Send

'clean up our variables
Set oMsg = Nothing
Set oApp = Nothing
Set oAcct = Nothing
0
 
TimKestermontAuthor Commented:
One more question about the code.  do until is there but the Loop is not.   If I place the loop after the oMsg.Send I get a runtime error, if I put it just after the oMsg.rec line I receive the mail dameon response in the email about he the attachment of subject-0.  This response is because it cuts of the last character-

Tested Loop above the sRecipient = Left(sRecipient, Len(sRecipient) -1)
result- 1 email sent and no errors-  other than I have more than 1 email that should of went.

Tested Loop after- sRecipient = Left(sRecipient, Len(sRecipient) -1)
result Mail Dameon-  it cut off the domain by one letter jack@home.or...  

I rem'd the  sRecipient = Left(sRecipient, Len(sRecipient) -1)
result-1 email sent and no errors-  other than I have more than 1 email that should of went.

I am close to letting this go.  Let me know how you feel about it.



0
 
flavoCommented:
oh yeah forgot the loop.....

(Cant copy and paste)

Dim oAcct As GroupwareTypeLibrary.Account
Dim oApp As GroupwareTypeLibrary.Application
Dim oMsg As GroupwareTypeLibrary.Message

'Create a new instance of GW for us to use in VBA
Set oApp = CreateObject("NovellGroupWareSession")
'Log in - note, you you dont have GW logged in, it will prompt with the usual login screen
' you can also use Set oAcct = oApp.Login("userName", "Password") if you want
Set oAcct = oApp.Login("", "")

'create a new email message for us to use
Set oMsg = oAcct.MailBox.Messages.Add

'as above
oMsg.Subject = "Subject - 0"
oMsg.BodyText = "Body Text"

Set MyDb = CurrentDb
Set MyRS = MyDb.OpenRecordset("Email Addresses", dbOpenDynaset)
MyRS.MoveFirst
Do Until MyRS.EOF
sRecipient = sRecipient & ";" & MyRS("EmailAddress")
MyRS.MoveNext
Loop

If Len(sRecipient) > 1 then
   'this if statement is used to stop it throwing an error if there were no email addresses
   sRecipient = Left(sRecipient, Len(sRecipient) -1)
end if

oMsg.Recipients.Add sRecipient, , 0  
oMsg.Send

'clean up our variables
Set oMsg = Nothing
Set oApp = Nothing
Set oAcct = Nothing
0
 
TimKestermontAuthor Commented:
I needed a good laugh today.  Thanks...I will try it.
0
 
TimKestermontAuthor Commented:
Are you able to send multiple emails?  I am only able to do one.
0
 
flavoCommented:
ahh... mustnt be able to to that

use this

Dim oAcct As GroupwareTypeLibrary.Account
Dim oApp As GroupwareTypeLibrary.Application
Dim oMsg As GroupwareTypeLibrary.Message

'Create a new instance of GW for us to use in VBA
Set oApp = CreateObject("NovellGroupWareSession")
'Log in - note, you you dont have GW logged in, it will prompt with the usual login screen
' you can also use Set oAcct = oApp.Login("userName", "Password") if you want
Set oAcct = oApp.Login("", "")

'create a new email message for us to use
Set oMsg = oAcct.MailBox.Messages.Add

'as above
oMsg.Subject = "Subject - 0"
oMsg.BodyText = "Body Text"

Set MyDb = CurrentDb
Set MyRS = MyDb.OpenRecordset("Email Addresses", dbOpenDynaset)
MyRS.MoveFirst
   
  Do Until MyRS.EOF
         oMsg.Recipients.Add MyRS("EmailAddress"), , 0
         MyRS.MoveNext
   Loop

oMsg.Send

'clean up our variables
Set oMsg = Nothing
Set oApp = Nothing
Set oAcct = Nothing
0
 
TimKestermontAuthor Commented:
Invalid argument was passed in the function call

oMsg.Recipients.Add MyRS("EmailAddress"), , 0
0
 
TimKestermontAuthor Commented:
If I step through on the old code docmdsend etc.... when I hover over the strTo it has the email address in it.
0
 
flavoCommented:
oMsg.Recipients.Add MyRS("EmailAddress")
0
 
TimKestermontAuthor Commented:
Doesn't work
I give...I'm done, can't take it anymore...I'll just say I can only do one email at a time.  

Thanks
0
 
flavoCommented:
rubish! i can be done

 I have an app that does almost exactly the same thing!
0
 
TimKestermontAuthor Commented:
So with one click you send multiple emails ?  I am still just sending one.\\

My tbl is Email Addresses and my field is emailaddress and when I f8 through the loop i get every email address but it still only sends one.
0
 
flavoCommented:
Tim,

Can you post your email address in a non-spam way  (ie Tim{at}somewhere DOT com)

Ill send you an email with my app.

Dave
0
 
flavoCommented:
do you actually have diferent email addresses?  GW is pritty smart, and if you try to add the same email address in 2 or more times, it still only sends it once
0
 
TimKestermontAuthor Commented:
yes,  I have two hotmail accounts for testing.  So I should get 3 emails.  But I only get one.
0
 
TimKestermontAuthor Commented:
post{seed&less&than&what""hotmaildotcom}4Flavo
0
 
flavoCommented:
geeee.. i hope i get it right, i can hardly work it out...
0
 
flavoCommented:
the email has made it to both my test emails
0
 
flavoCommented:
maybe the hotmail servers are down????
0
 
TimKestermontAuthor Commented:
wait a sec b4 you send....I may have found the issue
0
 
TimKestermontAuthor Commented:
Excellent- This is working!!!!! Don't get it as far as why it wasn't prior.  I think my hotmail accounts were full or something.  But I opened a couple of office accounts through my VPN and it works great!  You rock man...and really thanks a tremendous amount for hanging with me in my stressful hour!  Now I can move on..
0
 
TimKestermontAuthor Commented:
Yes I did get your email...no attachment or anything like that just a strange message from hotmail
0
 
flavoCommented:
Glad its all working now!


>>  I think my hotmail accounts were full or something

Damn spammers!

dave
0
 
flavoCommented:
It should have said

This email was sent at1/10/2004 3:03:28 PM
0
 
TimKestermontAuthor Commented:
it's 21:20AM here ...Now I can sleep!  Thanks
0
 
flavoCommented:
very easy to add attachements

all you need to do (for example) is to add

oMsg.Attachments.Add "c:\someFileToAttach.txt"


just bfore you send - just before this line  ->     oMsg.Send

Dave
0
 
flavoCommented:
Its 3:20pm on Friday afternoon, nearly time to hit the pub for some tastey beers

Later!

Good luck!

Dave
0
 
TimKestermontAuthor Commented:
Thanks for the attachment infor...I am very appreciative of your help.  Where are you?  Like Hawaii?
0
 
flavoCommented:
Australia mate.. in Brisbane
0
 
flavoCommented:
like you its now 1:15AM (Saturday) :-)
0
 
flavoCommented:
>> like you

Like you -> as in, for some reason i decide to stay up and visit EE....
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.