Send Email with Access 2007

I used the code below in Access 2002 and it worked fine.  Just upgraded to 
Access 2007 and I am getting an error message as I try to send an email.  

The error message is:
‘The command or action ‘SendObject’ isn’t available now’

I have set a reference to Microsoft Outlook 10.0 Object Library 

I have MS Office 2007 installed (and Outlook 2007 is installed) but the 
reference seems to be pointing to Outlook 2002.  I referenced the highest 
order of Outlook that I could find in my available references.  I’ve seen 
higher order references in the list; for instance I have a reference for 
Microsoft Excel 12.0 Object Library (but no 10.0 Object Library)

Here is the code that I am working with:

Option Compare Database

Private Sub cmdMail_Click()
    On Error GoTo Err_cmdMailTicket_Click

    Dim varTo As Variant        '-- Address for SendObject
    Dim stText As String        '-- E-mail text
    Dim RecDate As Variant      '-- Rec date for e-mail text
    Dim stSubject As String     '-- Subject line of e-mail
    Dim strSQL As String        '-- Create SQL update statement
    Dim stWho As String         '-- Reference to tblUsers
    Dim errLoop As Error
    Dim strFirstName As String

    '-- Combo of names to assign ticket to
    stWho = Me.cboUser
    stWhere = "Users.strUserID = " & "'" & stWho & "'"
    '-- Looks up email address from Users
    varTo = DLookup("[strEMail]", "Users", stWhere)

    stText = ", please see the attachment." & Chr$(13) & Chr$(13) & _
             "Thanks," & RecDate & Chr$(13) & Chr$(13) & _
             "Ryan---"

    'Write the e-mail content for sending to assignee
    DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, -1

    On Error GoTo Err_Execute
    CurrentDb.Execute strSQL, dbFailOnError
    On Error GoTo 0

    Exit Sub

Err_Execute:
    Resume Next
Exit_cmdMailTicket_Click:
    Exit Sub

Err_cmdMailTicket_Click:
    MsgBox Err.Description
    Resume Exit_cmdMailTicket_Click

End Sub

Basically, I used to be able to select a record from a ComboBox, and send an 
email to that record.  Now, when I click the CommandButton, I get the error 
message: ‘The command or action ‘SendObject’ isn’t available now’

As an aside, I am running Office 2002 and Office 2007 (simultaneously) on my 
ThinkPad.  I have had trouble running several VBA-driven Access 2002 files 
(most give me errors, but some work perfectly well).  AFAIK, Office 2002 and 
Office 2007 work in on the same machine, right.  I’ve only had problems with 
VBA in Access.  I do lots of VBA work in Word and Excel too; Access is the 
only app that gives me problems

Thanks everyone!
Ryan---


-- 
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
0
Utf
2/1/2010 7:51:02 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

2 Replies
1496 Views

Similar Articles

[PageSpeed] 43

ryguy7272 wrote:
>I used the code below in Access 2002 and it worked fine.  Just upgraded to 
>Access 2007 and I am getting an error message as I try to send an email.  
>
>The error message is:
>‘The command or action ‘SendObject’ isn’t available now’
>
>I have set a reference to Microsoft Outlook 10.0 Object Library 
>
>I have MS Office 2007 installed (and Outlook 2007 is installed) but the 
>reference seems to be pointing to Outlook 2002.  I referenced the highest 
>order of Outlook that I could find in my available references.  I’ve seen 
>higher order references in the list; for instance I have a reference for 
>Microsoft Excel 12.0 Object Library (but no 10.0 Object Library)
>
>Here is the code that I am working with:
>
>Option Compare Database
>
>Private Sub cmdMail_Click()
>    On Error GoTo Err_cmdMailTicket_Click
>
>    Dim varTo As Variant        '-- Address for SendObject
>    Dim stText As String        '-- E-mail text
>    Dim RecDate As Variant      '-- Rec date for e-mail text
>    Dim stSubject As String     '-- Subject line of e-mail
>    Dim strSQL As String        '-- Create SQL update statement
>    Dim stWho As String         '-- Reference to tblUsers
>    Dim errLoop As Error
>    Dim strFirstName As String
>
>    '-- Combo of names to assign ticket to
>    stWho = Me.cboUser
>    stWhere = "Users.strUserID = " & "'" & stWho & "'"
>    '-- Looks up email address from Users
>    varTo = DLookup("[strEMail]", "Users", stWhere)
>
>    stText = ", please see the attachment." & Chr$(13) & Chr$(13) & _
>             "Thanks," & RecDate & Chr$(13) & Chr$(13) & _
>             "Ryan---"
>
>    'Write the e-mail content for sending to assignee
>    DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, -1
>
>    On Error GoTo Err_Execute
>    CurrentDb.Execute strSQL, dbFailOnError
>    On Error GoTo 0
>
>    Exit Sub
>
>Err_Execute:
>    Resume Next
>Exit_cmdMailTicket_Click:
>    Exit Sub
>
>Err_cmdMailTicket_Click:
>    MsgBox Err.Description
>    Resume Exit_cmdMailTicket_Click
>
>End Sub
>
>Basically, I used to be able to select a record from a ComboBox, and send an 
>email to that record.  Now, when I click the CommandButton, I get the error 
>message: ‘The command or action ‘SendObject’ isn’t available now’
>
>As an aside, I am running Office 2002 and Office 2007 (simultaneously) on my 
>ThinkPad.  I have had trouble running several VBA-driven Access 2002 files 
>(most give me errors, but some work perfectly well).  AFAIK, Office 2002 and 
>Office 2007 work in on the same machine, right.  I’ve only had problems with 
>VBA in Access.  I do lots of VBA work in Word and Excel too; Access is the 
>only app that gives me problems
>
>Thanks everyone!
>Ryan---
>
I don't see anything wrong  syntax wise. Here's a sample of sending an email.
http://www.databasedev.co.uk/send_email.html

The only thing I can think of is some piece(s) of Office 2002 and Office 2007
could be interfering with each other. I have heard of people using 2002 and
2007 simultaneously, but I don't know if there were any situations/issues
with regard to the order of installations or the placement of files/folders.

-- 
Message posted via http://www.accessmonster.com

0
orange
2/2/2010 2:15:44 PM
Thanks Orange!  I ended up loading my 2002 Office CD, did a repair, and the 
issue went away.


-- 
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"orange via AccessMonster.com" wrote:

> ryguy7272 wrote:
> >I used the code below in Access 2002 and it worked fine.  Just upgraded to 
> >Access 2007 and I am getting an error message as I try to send an email.  
> >
> >The error message is:
> >‘The command or action ‘SendObject’ isn’t available now’
> >
> >I have set a reference to Microsoft Outlook 10.0 Object Library 
> >
> >I have MS Office 2007 installed (and Outlook 2007 is installed) but the 
> >reference seems to be pointing to Outlook 2002.  I referenced the highest 
> >order of Outlook that I could find in my available references.  I’ve seen 
> >higher order references in the list; for instance I have a reference for 
> >Microsoft Excel 12.0 Object Library (but no 10.0 Object Library)
> >
> >Here is the code that I am working with:
> >
> >Option Compare Database
> >
> >Private Sub cmdMail_Click()
> >    On Error GoTo Err_cmdMailTicket_Click
> >
> >    Dim varTo As Variant        '-- Address for SendObject
> >    Dim stText As String        '-- E-mail text
> >    Dim RecDate As Variant      '-- Rec date for e-mail text
> >    Dim stSubject As String     '-- Subject line of e-mail
> >    Dim strSQL As String        '-- Create SQL update statement
> >    Dim stWho As String         '-- Reference to tblUsers
> >    Dim errLoop As Error
> >    Dim strFirstName As String
> >
> >    '-- Combo of names to assign ticket to
> >    stWho = Me.cboUser
> >    stWhere = "Users.strUserID = " & "'" & stWho & "'"
> >    '-- Looks up email address from Users
> >    varTo = DLookup("[strEMail]", "Users", stWhere)
> >
> >    stText = ", please see the attachment." & Chr$(13) & Chr$(13) & _
> >             "Thanks," & RecDate & Chr$(13) & Chr$(13) & _
> >             "Ryan---"
> >
> >    'Write the e-mail content for sending to assignee
> >    DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, -1
> >
> >    On Error GoTo Err_Execute
> >    CurrentDb.Execute strSQL, dbFailOnError
> >    On Error GoTo 0
> >
> >    Exit Sub
> >
> >Err_Execute:
> >    Resume Next
> >Exit_cmdMailTicket_Click:
> >    Exit Sub
> >
> >Err_cmdMailTicket_Click:
> >    MsgBox Err.Description
> >    Resume Exit_cmdMailTicket_Click
> >
> >End Sub
> >
> >Basically, I used to be able to select a record from a ComboBox, and send an 
> >email to that record.  Now, when I click the CommandButton, I get the error 
> >message: ‘The command or action ‘SendObject’ isn’t available now’
> >
> >As an aside, I am running Office 2002 and Office 2007 (simultaneously) on my 
> >ThinkPad.  I have had trouble running several VBA-driven Access 2002 files 
> >(most give me errors, but some work perfectly well).  AFAIK, Office 2002 and 
> >Office 2007 work in on the same machine, right.  I’ve only had problems with 
> >VBA in Access.  I do lots of VBA work in Word and Excel too; Access is the 
> >only app that gives me problems
> >
> >Thanks everyone!
> >Ryan---
> >
> I don't see anything wrong  syntax wise. Here's a sample of sending an email.
> http://www.databasedev.co.uk/send_email.html
> 
> The only thing I can think of is some piece(s) of Office 2002 and Office 2007
> could be interfering with each other. I have heard of people using 2002 and
> 2007 simultaneously, but I don't know if there were any situations/issues
> with regard to the order of installations or the placement of files/folders.
> 
> -- 
> Message posted via http://www.accessmonster.com
> 
> .
> 
0
Utf
2/7/2010 3:37:01 PM
Reply:

Similar Artilces:

Errors accessing shared speadsheet.
I have a group of users who access a shared Excel spreadsheet. The spreadsheet is on a Novell server. Starting out they all could access the spreadsheet fine. Starting recently people have begun to receive memory errors when accessing or saving the spreadsheets. If you log into windows as a different user but still use the same ID in Novell it works fine for a period of time then recieves the same error. This seems to be a microsoft issue as after you recieve the error you can copy the file local and it still errors. logon as a different user in windows and it works fine. any help wou...

How do I send copies emails without sending attachments?
I send emails with attachments to our bank. My boss wants a copy of the email but not a copy of the attachment. How do I do that? Steve Bramblett wrote: > I send emails with attachments to our bank. My boss wants a copy of the > email but not a copy of the attachment. How do I do that? Each recipient gets the SAME copy of the e-mail. If you want different recipients to get different versions of your e-mail, you have to send different e-mails. ...

No message in outbox
I tried to send a message with 1Mb attachment to 40 recipients in the bcc field. It gave me an error message from the isp's server, the message was NOT sent (I've checked), it did NOT arrive in Sent Items, but neither is it in the Outbox any more. I can send and receive email successfully. Problem is, every few minutes Outlook tells me it's sending message 1 of 1, it fails and gives me the same error message. Yet there is no message in the Outbox. But what happened to the original message when it first failed to send? I guess it's 'stuck' somewhere but I can...

Sending mail from selected email address
Hi All, As I have 4 email accounts set up in Outlook, I understand that I can send mail from each or any account. The accounts are listed under tools / Send and Receive / then each of the accounts. How can I choose which account to send from so that the recipient see's who I want it to be from?? Hope that explains it. Regards Alan On Sat, 16 Apr 2005 21:10:48 -1000, The Fatman <albaxter@optushome.com.au> wrote: > Hi All, > > As I have 4 email accounts set up in Outlook, I understand that I can > send > mail from each or any account. > > The acco...

PowerPoint 2003 to accessible Word 2003 via VBA?
I'd like to extract all content from a Windows PowerPoint 2003 document and place it in a Word 2003 document, as Word to PDF conversion seems to provide better-quality tagging than a PowerPoint to PDF conversion. I know I can save the outline as RTF and open that in Word, but the outline does not include any of the following: - text added on a blank slide layout - text in a text box - tables. - images. Is there any way to copy all content from a PowerPoint presentation to a Word document, such that all text remains text and all tables remain as tables? Charles Belo...

Sending a macro to another PC-how?
How do you send a macro you've written to another PC so that they can save it in their Personal.xls file (at Program Files\Microsoft Office\Office\XLStart)? You can export a macro and save it, to do this from your workbook, right-click the workbook's icon and pick View Code. This icon is to the left of the "File" menu this will open the VBA editor, click on the module you want to save and go to file and export file, then save it to a floppy or what ever you backup to, then import it to the new workbook. -- Paul B Always backup your data before trying something new Using ...

Outlook 2007
Hi, I am having the following problem with Outlook 2007. Whenever I run outlook the CPU utilization goes up over 99%. I've been using OL 2007 for over 4 months and it was working fine. Tried repairing/recreating the OST and PST files. Tried disabling all Add-ins (LinkedIn, Outlook Connector, etc.) tried running Outlook in Safe Mode. Nothing seems to work. Anyone has any ideas as to what might be wrong?? I havent recently installed or uninstalled anything on my machine. I am running Windows XP with Service Pack 2, Norton Antivirus, RealSecure Desktop protector. Do you have iTunes/iPod...

Sending mail from remote location
my mail works great while at home. when I go on the road I can receive ail but not send. I get the following error message: Subject 'SKIDOO MACH Z 800LT (long track / long tunnel) (Jackson)', Account: 'Jeff', Server: 'smtp.charter.net', Protocol: SMTP, Server Response: '571 imp11 smtp.charter.net OTcuMTQ3LjE2LjIzMA== You must connect from Charter IP space. E1110', Port: 25, Secure(SSL): No, Server Error: 571, Error Number: 0x800CCC61 It worked on my last laptop and I have not been able to figure it out on this one. I can't remember what I...

Send and Recieve Fix
For a long time I had a problem with my Send/Recieve function in Outlook. This happended in both Outlook 2000 and my current version - 2007. I found I had to re-boot my computer to perform a Send/Recieve in Outlook. Otherwise the sequence would start then stop and say it could not perform due to an error. After extensive Internet and News Group research I decided it was time to run a check on disk errors. This Windows XP facility seemed to have fixed my Outlook problem. I did this about a few months ago now and I have since had no problems with my send and recieve. Unfortunately I do have ...

Forwarding email to Blackberry to a remote server
I have Blackberry with an email address on a server in NYC that runs BES 4 and exchange 2000. And I want to have people email to an address on an exchange 2000 server in Albany, NY and have exchange forward the emails to the person's mailbox and to the Blackberry in NYC. I have setup the forwarding system as prescribed by MS, but when people on the NYC domain email the Albany address they get this error message: From: System Administrator Sent: Friday, February 11, 2005 1:57 PM To: Gary Subject: Undeliverable:RE: Delivery Status Notification (Failure) Your message ...

can't download pop3 email
This is my error message Task Receiving reported error 0x800CCC0F The connection to the server was interrupted If this problem continues contact your server administrator or your ISP The server responded +OK How do I fix this? What did your ISP say? --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After scratching one's head, M Pond <anonymous@discussions.microsoft.com> asked this group: | This is my error mes...

Is there a workaround for Access 2007 failure with a control recordsource =SubformControl.Form.RecordsetClone.RecordCount?
After spending hours fighting this problem in a newly upgraded database, I found Allen Browne's documentation that Access 2007 introduced a new bug where a control recordsource like this fails: =iif(SubformControl.Form.RecordsetClone.RecordCount=0, 0, SubformControl.Form.txtSubformTotal). Thank you to Allen for nailing the problem. Since I'm using SP1 and seeing the same problem, I gather it has not been fixed yet. Has anyone come up with a good workaround? I have avoided the issue for now by using =SubformControl.Form.NewRecord, but that only worked by allowing additions in the...

.EMAIL ATTACHMENTS #2
I have received emails lately that have an attachment with the extension of .email. I can't get these attachments to open. When I double click, it appears to start to open, but really nothing happens. Any advice? Please respond to email address above. Thanks! The closest "legal" file extension would be .eml , which is the Outlook Express default file extension. Regardless of the file name, extension type, you should be very careful with any file attachments if they are unexpected from people you do not know. If the message is from someone you are expecting a file att...

Unable to send?
Hi, I've got MOOL, and i"m usign ti with outlook. The emails that I'm sending are just "stuck" in the outbox? Can anyone give me an idea of what's going on? Rex Did it ever work? Are you able to receive? -- Aloha, -Ben- Ben M. Schorr, OneNote-MVP Roland Schorr & Tower http://www.rolandschorr.com Microsoft OneNote FAQ: http://www.factplace.com/onenotefaq.htm **I apologize but I am unable to respond to direct requests for assistance. Please post questions and replies here in the newsgroup. Mahalo! "Rekks" <rex_flynn@hotmail.com> wrote ...

Excel to Email
Hi Our sales people need to send to our sales manager on a daily basis a list of the sales orders that they created for that day. I created a private view named 'Daily Sales Orders' and showed each person to export to Excel. I was wondering if anyone knows of an easier way to do this. I would ideally like to mail merge or email template something similar. Ideally it would be nice for a sales people to create an email an insert their list for that day. Appreciate any suggestions. Thanks Mark As a thought, SQL Reporting can be configured to send a report, by email automatical...

No Permission to Send/Receive Email???
I just replaced our server hardware, upgraded to WS 2k3 Enterprise and created a new domain. I transferred the client files and desktop on our desk/laptop computers over to the new domain. We do NOT have Exchange installed yet, but use Outlook 2002 with the email etc. saved on the client. One one client machine (mine), the email, calendar, etc are there, but when I hit the Send/Receive button, I get a message saying that I don't have permission to perform this operation. Also when I try and change the automatic check for email option it tells me I don't have permission. ...

Web Access #2
Hey guys, I cannot user Outlook Web Access anymore, where can I troubleshoot this? You haven't said what version, and given very little information to go on, so this reply may be way off. You could start with the OWA troubleshooting guide: http://www.microsoft.com/technet/prodtechnol/exchange/2000/support/troubowa.mspx -- Neil Hobson Exchange MVP For Exchange news, links and tips, check: http://www.msexchangeblog.com "Melvin" <mrodriguez@nyas.org> wrote in message news:eh61ZzrWEHA.808@tk2msftngp13.phx.gbl... > Hey guys, I cannot user Outlook Web Access anymore,...

MS Access Filter question
I have a column that gives me the results; /dir/dir/customer name I want to filter out the /dir/dir/ so the column results just show the customer name, I think a substr() might work but I am not sure how the syntax would look. Any suggestions? -- Neall Use InstrRev() to find the last / in the string. Then use Mid() to get the remainder from there. (You can also use Dir() around the file name to lose the path.) -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. &q...

Sending messages in Outlook
We have a user that everytime that she sends an email she will get booted out of Outlook. The email does go through, but she will have to get out of Outlook. When she goes back into Outlook, everything is fine until she sends another message. Any help would be appreciated. ...

Anyway to repair corrupt Publisher 2007 file?
I've searched and can't find a solution. Any ideas? How to troubleshoot a damaged publication in Publisher http://support.microsoft.com/kb/198256/en-us Is your anti-virus software current? An out-of-date antivirus program may cause errors when you try to open an Office document or to start Outlook http://support.microsoft.com/kb/835404/en-us Error message when you try to open a publication in Publisher: "Publisher cannot open the file" or "Publisher has detected a problem" http://support.microsoft.com/kb/928890/en-us -- Mary Sauer MSFT MVP http://office.micr...

Clicking on new mail notification does not open email
This is a multi-part message in MIME format. ------=_NextPart_000_0053_01CACB73.FC871830 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I finally upgraded from WLM 2 to 3 (14.0.8089.0726) this afternoon (Win = XP SP2). When I get a new mail notification via Messenger and click on = it the email does not open. I have to go to the inbox to open it. Any = ideas? Kevin ------=_NextPart_000_0053_01CACB73.FC871830 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTY...

Send Do Not Send
When I attempt to email via a print server - OutLook Express displays the message "A program is attempting to email on your behalf" Send or Do Not Send - How do you prevent this from happening? And just automatically send? ...

Money 2000 Canadian Edition to Money 2007
Hi, I am having problems importing Money 2000 Canadian Edition into Money 2007. Money 2007 just complains that the data file has been created using another version of money. Has it been proven that Money 2007 can convert Money 2000 Canadian? How about MS Money 2006 Canadian Edition? I want to upgrade to a newer version and I don't want to purchase Money 2006 just to find out that it won' convert either. Money 2007 will not import Can 2000 for the main reason Canadian versions only go to 2005 and money cannot convert from Can to Us what you have to do is open the file in 20...

Sending on behalf... Exchange 2003
Hi everyone, Is there a better way to give a few users the ability to send mails also from the info@domain.com mailbox without having them logout and login to a different Outlook 2003 profile... Or without the text sending on behalf of... So my question is, Is there an easy way that a user can select another e-mail address and send mails out...? Thanks a lot in advance!! Regards, BY On Thu, 05 Oct 2006 12:57:12 GMT, "BY" <nospam@mail.com> wrote: >Hi everyone, > >Is there a better way to give a few users the ability to send mails also >from the info@dom...

What was Outlook sending?
Hi, I downloaded my messages using the option "send and receive all". However, the "Show Progress" box indicates that I was also 'sending something'. But I had nothing to send! I look in the "Sent items' folder and nothing was sent at this time. What was Outlook 2003 doing? Santista The usual response here is, "You have a virus". It could be that a virus program is using your Outlook to send spam and/or a copy of itself to people in your address book. I hope this is not the case, but please have the foresight (aftersight?) to look into ...