VBA Code work on computer A, but not computer B

c1bluemini

Registered User.
Local time
Today, 08:15
Joined
Dec 12, 2013
Messages
23
I have code in place for sending emails when anyone enters a new record into my access database. This works fine from my local computer as well as another computer on our network. My problem is that its not working anywhere else.

All of the computers involved are running windows 7 (64 bit) machines. We are all running Office 2010 (32 bit version). I have one machine beside my local computer and have been comparing the setting of each machine to see what is different, and I have found nothing.

Like I said above, my local machine runs the scripts fine and the emails get sent, but the other machines keep getting the standard "runtime error -2147220973 (80040213) The transport failed to connect to the server" error. The database itself is stored on our windows 2008 server and everyone is accessing it from there on a as needed bases.

Has anyone else had this issue and if so how did you fix it? Any help or information would be greatly appreciated. :banghead:
 
I think I would create a barebones email routine database on the machine(s) that do not work to see if it's the machine or the app - ?
 
The transport failed to connect to the server"
This type of message points at the setup/authorisation of the mail code relative to the mail server: check ports, username/password all these things in the setup of mailing application.
 
spikepl, I would have to agree except it is currently running fine on two other computers on our network but non of the others.

KenHigg- I did as you suggested and created a very basic email routine and still getting the same error "The transport failed to connect to the server"". Its almost like I have something missing in the software that is not allowing it to look for the smpt server. The error pops up a mere second after I hit the button.
 
it is currently running fine on two other computers on our network but non of the others.

Did you or did you not check those settings? And how they relate to the logged-in user on the respective machine?
 
Spikepl- yes, I did check all of the settings and they all match between machines. I am logging into each machine using the same login credentials in an effort to keep things consistent.

KenHig- here is the code (its pretty basic):

Private Sub Command74_Click()

Set cdomsg = CreateObject("CDO.message")
With cdomsg.Configuration.Fields

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'NTLM method
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smptserverport") = 587
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "MyEmail@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "MyPassword"
.Update

End With
' build email parts
With cdomsg

.To = "whendrickson@hennegan.com"
.From = "carparcc.alert@gmail.com"
.Subject = "A CAR/PAR/CC has been updated"
.TextBody = "CAR/PAR/CC Action # " & [ActionID] & " has been updated for root cause."
.Send

End With
Set cdomsg = Nothing

DoCmd.Close

Dim stDocName As String
stDocName = "Main Menu"
DoCmd.OpenForm stDocName
End Sub
 
Have you tried stepping through the code as it executes?
 
Yes.....and on the machines that it does not work, it always stops at the ".send"

I have checked to insure that the ports are open not to mention that I made sure that the anti virus was turned off on some of the testing to see if that was causing the issue. But still was getting the same error.
 
Have you opened outlook and sent an email manually?
 
Have you checked to see if the references have been set up to see the outlook objects?
 
KenHigg,

Not sure I fully understand what your asking. Which references are you referring too?

wm
 
Access needs to know where the code is for the outlook objects. If you go: VBA window->Tools->References on the machine that does work and make sure you have the same ones checked in the machine that does not work ?
 
in your bare bones test did you take things like [Action], etc?

edit: Post your bare bones test code
 
KenHigg- Yes, when I did the bare bones test, I took out everything except the email address and used "test" as the subject and message body. Kept it very simple.
 
So... I know this is going to be redundant but - Did you see if the barebone database/code worked on the machine that the original code works on?
 
Here was the last version I tried.


Private Sub Testemail_Click()
Set cdomsg = CreateObject("CDO.message")
With cdomsg.Configuration.Fields

.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'NTLM method
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smptserverport") = 587
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "MyEmail@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "MyPassword"
.Update

End With
' build email parts
With cdomsg

.To = "workemail"
.From = "carparcc.alert@gmail.com"
.Subject = "Testing"
.TextBody = "test"
.Send

End With
Set cdomsg = Nothing
End Sub
 
Yes, I ran the same code on both machines. Code works fine on my regular machine, but does not run on my back up.
 

Users who are viewing this thread

Back
Top Bottom