UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Useing VBA To Run Mail Program, Access 2013    
 
   
youngb
post Jul 11 2018, 08:37 AM
Post#1



Posts: 540
Joined: 2-September 03
From: Galway, Ireland


Hi,

I am using the following code to run a mail program called: BMail.exe

CODE
        Shell ("K:\Database System\Training\bmail\bmail.exe -s XSERVERV.MASPAC.LOCAL -t " & EmailAddress & " -f " & ReturnEmail & " -h -a """ & EmailSubject & """ -b ""Hello. " & vbNewLine & vbNewLine & "IT Systems sent you the following message: " & vbNewLine & vbNewLine & EmailBody & vbNewLine & vbNewLine & DATE & vbNewLine & vbNewLine & "Regards, " & vbNewLine & vbNewLine & "IT Systems.""")


it is working fine with Access Runtime 2003, but two computers have been upgraded to Access Runtime 2013 and now the exact same code does not run,
does anybody have any idea why it would not work,

Is it to do with the 'Shell' command or to do with bmail.exe.

Now note everything else remains the same,
Thanks in advance for any helpful suggestions.
Go to the top of the page
 
GroverParkGeorge
post Jul 11 2018, 08:44 AM
Post#2


UA Admin
Posts: 33,025
Joined: 20-June 02
From: Newcastle, WA


"...does not run..."

What DOES happen instead? An error? Nothing? Or something else?



--------------------
Go to the top of the page
 
youngb
post Jul 11 2018, 08:48 AM
Post#3



Posts: 540
Joined: 2-September 03
From: Galway, Ireland


Hi,

Thanks for the response


that is the tricky part,

nothing happens, no error, no email sent, nothing,
I don't know if it has a problem with the Shell command or what?
Go to the top of the page
 
cheekybuddha
post Jul 11 2018, 08:55 AM
Post#4


UtterAccess VIP
Posts: 10,140
Joined: 6-December 03
From: Telegraph Hill


>> Now note everything else remains the same <<

OK, but the systems have been updated, so will you double check:
1. Drive K: is still mapped properly on those machines.
2. bmail.exe is still located at the location 'K:\Database System\Training\bmail\'

Also, when calling a command line program, don't you have to enclose the program being called in quotes if there is a space in its folder path?

What happens if you try:
CODE
Shell ("""K:\Database System\Training\bmail\bmail.exe"" -s XSERVERV.MASPAC.LOCAL -t " & EmailAddress & " -f " &
' ... etc


hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
youngb
post Jul 11 2018, 09:01 AM
Post#5



Posts: 540
Joined: 2-September 03
From: Galway, Ireland


Hi,



valid point, but I am still running the same code on other machines, that have the Access Runtime 2003 and it runs, so it has to be still there and I know the k drive is mapped because it is using the k drive for other things.
I will try that alternative code.
Thanks for the suggestion.

Regards
Brian

Go to the top of the page
 
GroverParkGeorge
post Jul 11 2018, 09:10 AM
Post#6


UA Admin
Posts: 33,025
Joined: 20-June 02
From: Newcastle, WA


One of the basic trouble-shooting steps I like to use is to set a breakpoint in the VBA and step through it, one line at a time.

That way you can watch variables as they change and sometimes see things that might not be expected.

--------------------
Go to the top of the page
 
youngb
post Jul 11 2018, 09:21 AM
Post#7



Posts: 540
Joined: 2-September 03
From: Galway, Ireland


Hi Guys,


tried the double quotes, no luck,
I am developing in a full version of Access 03, so I think my best chance to try a full version of Access 2014.

Thanks
Again

Brian
Go to the top of the page
 
cheekybuddha
post Jul 11 2018, 09:41 AM
Post#8


UtterAccess VIP
Posts: 10,140
Joined: 6-December 03
From: Telegraph Hill


I agree with George.

Break it down a bit:
CODE
  Dim strCmd as String, strPathToExe As String

  strPathToExe = "K:\Database System\Training\bmail\bmail.exe"
' Double-check we can find exe
  If Len(Dir(strPathToExe)) = 0 Then
    MsgBox "Can't find bmail.exe"
    Exit Sub
  End If

  strCmd = strPathToExe  & " -s XSERVERV.MASPAC.LOCAL -t " & EmailAddress & " -f " & ReturnEmail & " -h -a """ & EmailSubject & """ -b ""Hello. " & vbNewLine & vbNewLine & "IT Systems sent you the following message: " & vbNewLine & vbNewLine & EmailBody & vbNewLine & vbNewLine & DATE & vbNewLine & vbNewLine & "Regards, " & vbNewLine & vbNewLine & "IT Systems."""
' Print command to Immediate Window (Ctrl+G) to check it's what you want
  Debug.Print strCmd

  Call Shell(strCmd)


Paste the output from the Immediate Window back here.

hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
youngb
post Jul 11 2018, 09:55 AM
Post#9



Posts: 540
Joined: 2-September 03
From: Galway, Ireland


Hi Guys,

yes I will give that a try.


Thanks
Brian
Go to the top of the page
 
youngb
post Jul 12 2018, 07:50 AM
Post#10



Posts: 540
Joined: 2-September 03
From: Galway, Ireland


Hi Guys,


got to the root cause of the problem by using a dos batch file to run the code:

CODE
C:\bmail\bmail.exe -s XSERVERV.MASPAC.LOCAL -t  byoung@goodmanmedical.ie  -f byoung@goodmanmedical.ie  -h -a 8~~Test  -b 8~~Test >> C:\bmail\Result.txt
>> C:\bmail\Result2.txt


that way when it still didn't work I was able to eliminate the issue of the different versions of the Access and it turned out to be some setting on the mail server that had nothing to do with my code but more to do with the pc's.
So I was able to get our technical support change the mail server setting and bingo we are back on track.

Thanks again for all the helpful suggestions.

Brain

Go to the top of the page
 
cheekybuddha
post Jul 12 2018, 08:04 AM
Post#11


UtterAccess VIP
Posts: 10,140
Joined: 6-December 03
From: Telegraph Hill


Hi Brian,

Congratulations on getting it sorted!

You may wish to edit your last post to remove or obfuscate your email address.

thumbup.gif

d

--------------------


Regards,

David Marten
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    18th July 2018 - 07:41 AM