473,657 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending email with attachment using Sendobject & Thunderbird client

16 New Member
Hi. I'm running win 10 (updated to most recent).
I've recently rebuilt my computer and have reinstalled Access 2007 and a split database. In the front-end there is a script to email a message to multiple recipients. I select the recipients from a list and click a "send" button, intending to send it as an email in Thunderbird. I'm using the standard Sendobject code.
It used to work and now doesn't. The same database is used on another computer (both front-end and back-end are on a cloud drive) without problems. I get the message:
"Runtime error 2046:
The command or action SendObject isn't available now."
I have spent days looking for a solution.
Can anyone help?
Thanks in advance.


Full code of subroutine follows. Note that in the following there is a function called ConcatRelated. It works to create a string of email recipients. It definitely works:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command76_Click()
  2. 'Check for empty Subject line
  3. If IsNull(Text89) Then
  4.     MsgBox "Please enter some text for the SUBJECT.", vbOKOnly, "Error"
  5.     Text89.SetFocus
  6.     Exit Sub
  7. End If
  8. 'Check for empty text
  9. If IsNull(Text73) Then
  10.     MsgBox "Please enter some text for the MESSAGE.", vbOKOnly, "Error"
  11.     Text73.SetFocus
  12.     Exit Sub
  13. End If
  14.  
  15. 'Determine the recipients to be sent an email
  16. Dim varItem As Variant
  17. Dim recipients As String
  18. 'Determine if at least one course has been selected
  19. If List77.ItemsSelected.Count = 0 Then
  20.     MsgBox "Please select at least one course", vbOKOnly, "Error"
  21.     Exit Sub
  22. End If
  23. 'Collect email addresses of the recipients
  24. recipients = ""
  25.  
  26. Lc = List77.ListCount
  27.  
  28. 'If "ALL" is selected, then select all courses
  29. If List77.Selected(1) Then
  30.     Dim i As Integer
  31.     For i = 0 To List77.ListCount - 1
  32.     List77.Selected(i) = True
  33.     Next i
  34. End If
  35.  
  36.         'loop through all selected courses
  37.             Dim z As Long
  38.             With List77
  39.  
  40.                 For z = 2 To Lc
  41.                   If List77.Selected(z) Then
  42.                     If Check81 Then recipients = ConcatRelated("Invoicemail", "BulkEmail", "[coursekey]= """ & .ItemData(z) & """", , ";") & recipients 'Email invoicees
  43.                     If Check79 Then recipients = ConcatRelated("StudentEmail", "BulkEmail", "[coursekey]= """ & .ItemData(z) & """", , ";") & recipients  'Email Students
  44.                  End If
  45.                 Next z
  46.             End With
  47.  
  48.     'remove duplicates
  49.     recipients = EliminateDupesInString(recipients, ";")
  50.     ' Calculate number of email addresses
  51.     If recipients <> "" Then x = Len(recipients) - Len(Replace(recipients, ";", ""))
  52.     MsgBox "There are " & Str(x) & " addresses."
  53.  
  54.     If recipients <> "" Then DoCmd.SendObject acSendNoObject, , acFormatRTF, "office@xxx.com", , recipients, Text89, Text73, True
  55.     DoCmd.Close
  56. End Sub
Oct 25 '21 #1
33 10728
NeoPa
32,568 Recognized Expert Moderator MVP
Have you tried to Dubug (Debugging in VBA) this code and seen what each variable holds at the time you get the error (Line #54) in your code?
Oct 26 '21 #2
ACB64
16 New Member
Hi NeoPa,
Thanks for answering. Yes, I have and everything checks out. The error appears only when the SendObject is attempted. All variables are valid. Also, it works on another machine, and also worked seamlessly prior to the rebuild.
I remember having this issue about 1 year ago and I found a solution, but have no idea what it was. How silly that I didn’t record the solution.
ACB
Oct 26 '21 #3
GazMathias
228 Recognized Expert New Member
Hi ACB64,

Doesn't SendObject negotiate with the default mail client? That would suggest that the problem seems to be outside of your Access solution. I do not use Thunderbird, but is there a setting for enabling this kind of automation?

Gaz
Oct 26 '21 #4
ACB64
16 New Member
Hi Gaz,
Yes, that’s my understanding, and exactly the reason for my problem. Previously, I had no problems with SendObject negotiating with Thunderbird. Now, however, after the rebuild, something is presumably different and I don’t know what it is.
Andrew.
Oct 26 '21 #5
ACB64
16 New Member
Hi Mycinegisters,
Any hints??? I checked out your blogs and didn’t find anything that looked related to my issue.
Andrew.
Oct 26 '21 #6
GazMathias
228 Recognized Expert New Member
Hi ACB64,

In Windows itself, when you right click a file and select Send To... Mail recipient does Thunderbird respond properly?

Is Thunderbird defined as the default mail handler in PC Settings -> Default apps?

Is the build of Thunderbird the same on your machine and the working machine, and are you able to directly compare settings?

Gaz
Oct 26 '21 #7
GazMathias
228 Recognized Expert New Member
Hi ACB64,

In addition to my prior questions I also meant to ask if both Office and Thunderbird are targetting the same architecture (x86 / x64)?

Gaz
Oct 26 '21 #8
ACB64
16 New Member
Hi Gaz,
Thanks for responding so quickly.
Yes, TB is the default email client in Windows.
Yes, the machine computer aus running TB 32 Bit and Access 2007 only had the 32 Bit architecture. I tried running the 64 Bit version of TB, but got the same problem. Then I went back to the 32 Bit Version of TB. The two machines are similar except the „working“machin e is running office 2013 and the corresponding version of Outlook. I even tried installing the Access 2013 runtime and ran the DB with that. No help. The problem was still there. I uninstalled the runtime. Apart from that, I can no differences. However, as stated previously, the “non working” machine used to work and the build is, as far as I can tell, the same a as before (Win 10, access 2007, TB, etc.)
Andrew.
Oct 26 '21 #9
GazMathias
228 Recognized Expert New Member
Hi Andrew,

Did the right click file -> Send To -> Mail recipient test work?

I assume the machine has been restarted since the reinstallation of Thunderbird? Shutdown / cold boot does not count (Win 10 fast boot shenanigans).

Gaz
Oct 26 '21 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
7041
by: Paul Lamonby | last post by:
Hi, I am sending a file from the server as an email attachment. The file is being attached no problem and sending the email, but I get an error when I try to open it saying it is corrupt. Obviuosly, the file is fine on the server, so the attachment code I am using must be corrupting it, but I dont know what it is: // send email with attachment function emailAttachment($to, $subject, $message, $name, $email,
1
1909
by: dave | last post by:
hi guys I m trying to execute few lines code tht i have copies from microsoft tech script centre. basically its to send email without using any smtp service. u can find the code snippet from following link. http://www.microsoft.com/technet/community/scriptcenter/en tscr/scrent16.mspx while executing this code in vbs file i was getting error:
3
4336
by: jdph40 | last post by:
I'm using Access 97. In the OnClick event of a button I have the code below. I looks at txtEmail and sends an e-mail message without further action from the user (user does not have to click Send as he would if he used DoCmd.SendObject.) However, I want to attach a report in Snapshot format. How would I modify my code to include a report? Thank you, JD
0
2937
by: Eddy | last post by:
We use Thunderbird as E-Mail client. When sending a report from MsAccess 2003 running under Windows XP, the attachment is a xxxx.tmp file instead of the required docname.rtf file. I do not have this particular problem when running under windows2003 server. The Windows Knowledge base only states this example when using Lotus Notes as e-mail client. The temp directory is empty. Anyone ideas? DoCmd.SendObject acReport, "" & stDocName &...
1
2869
by: Nick Gilbert | last post by:
Hi, I'm writing a Windows Forms application in .NET and I need to send an e-mail from it. As it's NOT asp.net, I don't have access to an SMTP server so I will have to send the e-mail using Simple MAPI. I can't seem to find a way of doing this in .NET as it seems .NET has no MAPI support (amazingly!). How can I reliably send an e-mail from a Windows Forms app from .NET?
5
2868
by: J-P-W | last post by:
I have some code, from this group (many thanks) that sends an attachment to an email. The following: Dim objNewMail As Outlook.MailItem Dim golApp As Outlook.Application Dim initializeOutlook As Boolean requires Microsoft Outlook xx Object Library in the references.
6
10443
by: brendan_gallagher_2001 | last post by:
Hi, Does anyone know how to create an attachment using a stream in classic ASP. I can see that it can be done in ASP.Net as per the article below: Initializes a new instance of the Attachment class with the specified stream and name. http://msdn2.microsoft.com/en-us/library/6sdktyws.aspx.
2
14248
by: clloyd | last post by:
I have an event that creates and email that works perfect however, now I want the code to find a file on our server and insert it as an attachment. I really want to use a pdf version but here is an example of the code calling for a Word document. The code to call the document is: stDocName = "S:\Misc\Policy\What to have prepared for audit.doc"
3
6631
by: phill86 | last post by:
Hi I am using the following code to send an email from access via outlook automatically DoCmd.SendObject acSendReport, stDocName, acFormatRTF, "User", , , , , False
11
6965
by: imahhua | last post by:
I am not a programmer and I usually use macro to fulfill some small functions. This time I use a Macro of "SendObject" to send report as Pdf format. it is working well when I test it while "Navigation Pane" is displayed. But after I hide the "Navigation Pane", the problem appears: If I cancel emailing by click "X" of outlook 2007 window,The system crashes. Access can not even be closed. The dialogue window shows"You can not exit Microsoft...
0
8402
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8608
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.