Hi Paul,
I just removed the embedded macro. Now where do I put the code? under the Invoice Report or the Order Details?
Hi Paul,
I just removed the embedded macro. Now where do I put the code? under the Invoice Report or the Order Details?
You put the code where you want the process to happen. That sounded like the double-click event of the email textbox.
Sorry, I was rushing, yes I forgot to enter quantity.
Yes, the DblClick event property of email textbox showed [Embedded Macro] instead of [Event Procedure]. There was no VBA code.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Paul,
I put the code in OrderDetail in the under Events DblClick where the email address is under the Customer Name.
Tried it out..this is what happened:
After Double Clicking where the email address is one piece of good news is that it brings up JUST that one invoice for that customer. Now here is the issues
1. It didnt put the email address in the email
2. When "X" out in the upper right hand corner of the email received error (see next)
Clicked on Debug and saw this..
I backed out of the debug and stopped it after I went and added what I thought from previous code recieved
DoCmd.OpenReport "Invoice", acViewNormal, , "[Invoice ID]=" & Me![Order ID]
DoCmd.SendObject acSendReport, , acFormatPDF, "email address", , , "Invoice", "email body text"
And the line was still yellow and I backed out of the debugging but saved this code and the form..
Tried it again and this time in where the email address is suppose to me it just said "email address" (slapping my forehead thinking of course its going to say that cuz the code said to say that dohhh)
But then something else happened..
I "X" out of the email..got the same errors/debugging info again..but this time when I just backed out of it this is what happened
to which when I closed out of this now froze my Access to which I had to use Cntl/Alt/Del in Task Manager to End the program
I am only going to be here at work for another 2 hours then I am gone until Monday. I would love to get this fixed before I leave for the weekend..
You both have been great and again thank you for your patience for my stupidity
Stephanie
Closing the email without sending will trigger that. You handle it with an error trap:
http://www.baldyweb.com/ErrorTrap.htm
In your case you probably want to simply take the message box out for that particular error number (2501 if memory serves).
Instead of "email address" need to reference the textbox on form as noted in post 16.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Ok now I just copied and pasted that code here that you have on that page..here is my questions in RED:
Private Sub E_mail_Address_DblClick(Cancel As Integer) <--Correct?
Dim db As DAO.Database
Dim rs As DAO.Recordset
On Error GoTo ErrorHandler
DoCmd.OpenReport "Invoice", acViewPreview, , "[Order ID]=" & Me![Order ID]
DoCmd.SendObject acSendReport, , acFormatPDF, , "email address", , , "Invoice", "email body text", True <---Correct?
ExitHandler:
Set rs = Nothing
Set db = Nothing
Exit Sub
ErrorHandler:
Select Case Err 'specific Case statements for errors we can anticipate, the "Else" catches any others <---What do you mean?
Case 2501
MsgBox "No data to display"
DoCmd.Hourglass False
Resume ExitHandler
Case Else
MsgBox Err.Description
DoCmd.Hourglass False
Resume ExitHandler
End Select
End Sub
If this is all correct above (besides taking out the "email address") then how can I get it to recognized the email address and put it where it belongs? (I will be putting a standard email body text later)
I remembered that was what the Macro did for me instead ..and now that is gone in place of doing this way
Stephanie
Take this line out:
MsgBox "No data to display"
and change this to point to the address, using whatever the actual name is:
DoCmd.SendObject acSendReport, , acFormatPDF, , Me.EmailAddress, , , "Invoice", "email body text", True
As to the header line, I'd leave it as Access created.
Change "email address" to reference the email textbox: Me.[E-mail Address]
Advise no spaces or special characters/punctuation (underscore is exception) in names. I am not sure if the field/textbox names have a hyphen but that is what I see in the image you posted although the procedure declaration does not show hyphen. Use either name with correct spelling.
Put whatever you want in place of "email body text".
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
ooops just saw the "Change "email address" to reference the email textbox: Me.[E-mail Address]" in previous post..let me try that too
Look in VBA help at SendObject. You have the email address in the CC argument instead of the TO argument.
Okay, I guess we are off by one comma.
As you type the SendObject code, look at the intellisense popup tips as an aid in building.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
YEEEHAWWW! (that is Texan for HIP HIP HOOORRRRAAYYY..LOL) WE GOT IT!! AND YOU MADE MY WEEKEND!!
THANK YOU THANK YOU THANK YOU!!
YOU GUYS ARE THE BEST!!
STEPHANIE!!