Runtime Error in Access 2007, works fine in 2003.

Artimus

New member
Local time
Today, 00:12
Joined
Jul 9, 2009
Messages
8
Runtime Error with DoCmd.SendObject in Access 2007, works fine in 2003.

Hi Guys. First time poster. Long time access user.

I recently made an addition to a database i designed.
It is a form, that uses the DoCmd.SendObject command, to send an email with the forms contents.

Code:
DoCmd.SendObject _
    acSendForm, _
    "hireRequest", _
    acFormatTXT, _
    "example@example.com", _
    , _
    , _
    "Request Form", _
    "[Message]", _
    False
Now, i designed it in access 2003, and tested in 2003 and it works flawlessly. To save buying licenses for multiple computers, we use the 2007 runtime.
However, when it tries to send it... runtime error, the program must now close.

Are there any work arounds?

Cheers
I appreciate any help.
 
Last edited:
....runtime error? Which one?
 
have you compiled the DB with Access 2007?
 
Nope I cant compile in 2007, I dont have Access 2007.
I downloaded the Access 2007 Runtime from the Microsoft website.. Instead of getting developer extensions for 2003. Everything else works fine when i write it in 2003 and run it with 2007 runtime.

The error it gives is "The program has caused a runtime error. The program must now close."

No other information unfortunately.


I found some other code examples which may work with 2007, but they all are much much more complex and the code I have does everything i need it to.
 
Can you post a tiny sample database for us to try to get it working in Access 2007?
 
I'll post the whole thing if thats acceptable.

Unfortunately not until Monday though.
 
Here you go. Zipped up. Its not too big.

http://www.access-programmers.co.uk/forums/attachment.php?attachmentid=27964&stc=1&d=1247451227

Now the forms in question are hireReturnRequest and hireTagger.

They both save the record in a table, for the hire department to see and get the equipment ready. And then it also emails it to the deliveries department to contact the customer and arrange delivery.

As soon as "Send to Warehouse" is clicked, it saves the record.. but runtime errors, and does not email it.
 

Attachments

The error problem is the DoCmd.DoMenuItem commands. They are not supported in Access 2007. These have been deprecated for 15 years. Replace them with modern commands.

I also found that the MAPI connection to Pegasus mail only worked if the EditMessage argument of SendObject was set to True.

Also note that for the distribution of Access Runtime 2007 you are required to hold at least one licence for 2007.
 
Really? I was unaware of that.

I was going by this;
The Access 2007 Runtime is similar to previous runtimes in that all design-related UI is either removed or disabled.

You do not need to buy any special SKU in order to redistribute the Access 2007 Runtime. You can freely redistribute it or point users to this download.
From here; http://www.microsoft.com/downloads/...d9-9dc6-4b38-9fa6-2c745a175aed&displaylang=en




Oh. So. It is the OTHER buttons? Not the email button.. that are causing a problem?
 
Last edited:
The command to send the email is still current. However you should remove those DoMenuItem commands.

I have also looked for the licencing and it appears the situation has changed in the past two years. When I first investigated, developers were suppossed to have one licence to 2007 for distributing the RunTime. I think this was to discourage 2003 users from continuing to develop in the old version.

Always seemed a silly requirement when anyone could just download it.
 
Its just weird that the other buttons work.. The delete record command that uses the DoMenuItem.. works fine in 2007. It only crashes when the email button is clicked.

Now i just tested something. On the computer that i have 2003 installed on, i also installed the 2007 runtime. I ran it, and for some reason it worked fine.

I'm going to try delete the buttons and see what happens.


Edit: Ok I deleted the buttons, plus the code.. all thats left is the email button plus the email code (pasted above). Tested in 2007, still gets a runtime error..
 
Last edited:
Maybe there is some problem with the MAPI connection to the mailer on other computers you have tried.

All the same it would be a good idea to upgrade those DoMenuItem commands.
 
That is a possibility. But they have 3 computers there, and all are doing it. The computer that i remotely connect to, is also there.. they are all the same, use the same mail application, etc, only difference between them is that I installed Office 2003 on it.

Are there any other ways of sending emails via access? I'm sure there must be..
 

Users who are viewing this thread

Back
Top Bottom