Solved sendobject error 2046 using runtime access (1 Viewer)

sammers101

Registered User.
Local time
Today, 11:24
Joined
May 11, 2012
Messages
89
When using runtime access (tried 2013 and 2016) I am getting an "SendObject isn't available right now" error. I have no problems with it when using the full version of Access. I'm using thunderbird. Maybe there is another code I can use or a way to get it to work? Some forums suggested https://www.everythingaccess.com/vbmapi.asp and that did not seem to work for me, maybe I need to do something else besides installing it?
I've attached a photo of the code I am using
 

Attachments

  • code.png
    code.png
    10 KB · Views: 237
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 08:24
Joined
Oct 29, 2018
Messages
21,467
Not sure if this will help, but maybe try removing the spaces from your object names first, just to see if that will make any difference.
 

sammers101

Registered User.
Local time
Today, 11:24
Joined
May 11, 2012
Messages
89
Tried to make a test database and it still has the error with no spaces in the names
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:24
Joined
May 7, 2009
Messages
19,230
Not all Commands are available at runtime.
 

sammers101

Registered User.
Local time
Today, 11:24
Joined
May 11, 2012
Messages
89
Makes sense. Is there another way I can send an email at runtime? I would be open to using outlook. I'm using thunderbird currently because I had a hard time getting outlook to work with gmail.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:24
Joined
Oct 29, 2018
Messages
21,467
Makes sense. Is there another way I can send an email at runtime? I would be open to using outlook. I'm using thunderbird currently because I had a hard time getting outlook to work with gmail.
I'm not sure if there is a list available somewhere, but I am not sure the SendObject method is not available in Runtime. You should be able to easily check that by creating a blank db that only has one form with one button that uses the SendObject method and see if it will run or not in a Runtime environment. Just a thought...
 

Gasman

Enthusiastic Amateur
Local time
Today, 16:24
Joined
Sep 21, 2011
Messages
14,257
Makes sense. Is there another way I can send an email at runtime? I would be open to using outlook. I'm using thunderbird currently because I had a hard time getting outlook to work with gmail.
I have seen CDO mentioned in the past?
Search for cdo here
 

sammers101

Registered User.
Local time
Today, 11:24
Joined
May 11, 2012
Messages
89
that could work if I could figure out the server settings. I tried a few things, I was thinking it should be: server: smtp.gmail.com port: 465, authentication: basic, SSL: yes
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:24
Joined
Oct 29, 2018
Messages
21,467
that could work if I could figure out the server settings. I tried a few things, I was thinking it should be: server: smtp.gmail.com port: 465, authentication: basic, SSL: yes
Oh, are you actually using GMail? Or, is that just for testing? You may have to adjust your Google Mail security settings to allow CDO to work.
 

sammers101

Registered User.
Local time
Today, 11:24
Joined
May 11, 2012
Messages
89
Works Awesome!
I didn't see a setting to allow less secure apps with my website's email server but I was able to get gmail to work. Only minor issue is before it would use whatever the default email was (I had two different ones) and now I'll have to code that in, but the alternative was buying several copies of the full suite of office just to RUN the database. Thanks!!
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:24
Joined
Feb 28, 2001
Messages
27,162
Depending on your site's security, using CDO MIGHT run into problems. But I'll also preface this by saying I was at a U.S.Navy site where the network was pretty tightly screwed down. You might not see this at all.

It happens, if you have a segmented network at your site, that your segment boundary will look at what is sending messages where, so that you might need to advise your network security person that you were planning to send mail from an "unusual" source. What happened to me was that at that boundary, there were filters for people sending SMTP messages (which is what CDO uses) and those filters didn't allow SMTP from MSACCESS.EXE to the designated mail server. They were expecting OUTLOOK.EXE because that is what sent most messages, but we were caught in one of those CATCH-22 situations where we COULDN'T use OUTLOOK because of security certificate issues. (And trust me, that is a LONG story.)

Anyway, if someone tries and fails to send messages using CDO and it looks like a "server not found" message reliably, talk to your network manager and see if they are seeing logs about sending mail from MSACCESS. It's just a network Access Control Entry to fix it, but you can't fix it unless you have network admin privileges.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:24
Joined
Oct 29, 2018
Messages
21,467
Works Awesome!
I didn't see a setting to allow less secure apps with my website's email server but I was able to get gmail to work. Only minor issue is before it would use whatever the default email was (I had two different ones) and now I'll have to code that in, but the alternative was buying several copies of the full suite of office just to RUN the database. Thanks!!
Hi. Congratulations! Glad to hear you got it to work. If it's not too "sensitive information," perhaps you could post the CDO settings you used to help others who may need to connect GMail with CDO in the future. Cheers!
 

sammers101

Registered User.
Local time
Today, 11:24
Joined
May 11, 2012
Messages
89
Hi. Congratulations! Glad to hear you got it to work. If it's not too "sensitive information," perhaps you could post the CDO settings you used to help others who may need to connect GMail with CDO in the future. Cheers!
I used the same settings server: smtp.gmail.com port: 465, authentication: basic, SSL: yes
I just had to allow less secure apps https://myaccount.google.com/lesssecureapps
We're not sending sensitive information, just the list of comic books our customers are receiving :)

I read that the attachment needs to be a file and can't reference a table so I was considering trying using SaveToFile to save the form I would like to email. I'm assuming I can't reference a table or field in the body of the email as well?
 

Users who are viewing this thread

Top Bottom