Error: The command or action 'SendObject' isn't available now. (1 Viewer)

sonic8

AWF VIP
Local time
Today, 07:22
Joined
Oct 27, 2015
Messages
1,412
Hi!

At a client there is a problem on *some* computers with DoCmd.SendObject.
It fails with the error: 2046 - The command or action 'SendObject' isn't available now.

On the affected computers, the Access application runs in Access 2024 32bit on Windows 11 and they use Thunderbird v146 64bit as email client, which is working by itself.

At first I suspected that the bitness mismatch between Access and Thunderbird might be causing the problem.
However, ...
- according to MAPI documentation the MAPISendMail function is bitness independent.
- there is at least one computer with exactly this configuration where DoCmd.SendObject does work as expected.

Are there any suggestions to resolve the SendObject error or how to do further diagnostics?


Please do not suggest using alternative means to send the email as workaround.

CDO is not a suitable option here as most of the emails must be edited before sending.

I noticed @arnelgp 's alternative approach to send mail with Thunderbird. However, I would prefer using DoCmd.SendObject to be independent of a specific email client and installation folder. - I still would consider this approach if everything else fails.
 
Just thinking out loud... Does Thunderbird open when you use Application.FollowHyperlink?
 
Does Thunderbird open when you use Application.FollowHyperlink?
Yes, it does.
This maybe could be an alternative. I'm somewhat reluctant to use this, as the template text of the email is dynamically generated and I cannot be sure whether the total length will be within the limits of a mailto hyperlink.
 
On the afflicted computers, use

Start >> Settings >> Apps >> Default Apps and compare the mail app on those machines to machines that work normally.
 
Start >> Settings >> Apps >> Default Apps and compare the mail app on those machines to machines that work normally.
I did this already; forgot to mention it.
They all have Thunderbird set as Default Email App. (There is no other email app installed.)
This settings appears to have little effect. On the one computer where it now works this was set initially, but sending emails with DoCmd.SendObject still failed. Only after I opened the configuration dialog within Thunderbird and there used the feature to make Thunderbird the default email client it started to work. Of course, I also tried this on other computers where doesn't work but it had no effect.
 
I now implemented a rather crude workaround...

I daisy chained multiple approaches to send the email one after the other.
1. I try DoCmd.SendObject, which at least works on some computers.
2. I use arnelgp's Thunderbird command line approach, which surprisingly even works with very long messages bodies (tested with up to 7000 characters). - Thank you, @arnelgp !
3. I use FollowHyperlink with a mailto-link. In theory the maximum body length (~2050 chars) may be exceeded, but the longest text based on past records was ~1700 chars and is already an edge case.

Once an approach succeeds, the sequence is aborted as the objective was achieved.
If all three fail, it fails.

I would still be interested in further information on how to diagnose and resolve the issue with DoCmd.SendObject though.
 
I would still be interested in further information on how to diagnose and resolve the issue with DoCmd.SendObject though.

OK, have you looked at system, application, or network event logs for the failing cases? The Event Viewer can be a useful debugging tool when dealing with system actions.
 

Users who are viewing this thread

Back
Top Bottom