SendObject in Macro Fails Second Time Through

DocB1973

Registered User.
Local time
Today, 09:35
Joined
May 12, 2010
Messages
16
This is my first post in this forum and hopefully I can find someone who has a solution for this problem that is driving me to drink (more). The entire macro works as designed except when someone uses the sendobject a second time. For example, the user goes through and sends a quote via email just fine. It returns to the form. The next time a user tries to send a quote via email it returns to the form but the entire application is frozen. I can not click on anything and have to use task manager to shut it down. Any help would be appreciated. A copy of the macro is attached (you will probably have to zoom to 250% to see it correctly). One other note - when the application freezes I get an error message that says:
"If you’re running a Visual Basic nodule that is using oLE or DDE, you nay need to interrupt the module"
 

Attachments

Last edited:
Here is a sample database which uses a form and looks at query, see if this can help you. The following information was created to help someone else with regards sending emails.

I created a simple database which will look at entries and anything that has a status of “over due” will send an individual email to the person who is assigned as long as you have an email address of course.

I have attached the code to a form so when you open the database open the form “frmEmailSample” the code is behind the command button, what you will have to be aware of is as follows:

In your database you will have to set the reference in VBA to use Outlooks code, so use Alt & F11 then go to the Tools Menu and selected references, ensure that Microsoft DAO 3.6 and Microsoft Outlook Object Library have been ticked.

That will allow the code to run when you copy it across, but you will obviously have a little work to do yourself ! I am using 2 text boxes on the form to allow you to send a topic and also the subject itself, you can amend them to be the field names you want to use. If you want the code to run from when you open the database you should copy the code into a New Module sheet (again in VBA go to Insert and Module, copy the code in and change the Private Sub at the top to a FUNCTION like this)

Function SendEmail ()
Code goes in between

End Function

Lastly for now, although this will send emails into outlook, you will receive a warning you are about to send an email, this will happen repeatedly which is very annoying so to get around this you can download some third party software (Free and safe) called YesNo here is the link, (I use this a lot in many different companies I develop for).

http://www.contextmagic.com/express-clickyes/


Let me know how you get on and if you need any further help setting this up.
 

Attachments

Trevor - thanks for the reply. Let me try it and I'll let you know how it goes. I am using Access 2007. Does that make any difference?
 
Trevor - thanks for the reply. Let me try it and I'll let you know how it goes. I am using Access 2007. Does that make any difference?

No it shouldn't make any difference, just ensure that you select the latest Outlook reference in the VBA screen.
 

Users who are viewing this thread

Back
Top Bottom