Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with send object using

Status
Not open for further replies.

johngordon

Technical User
Jun 29, 2002
112
0
0
US
I am trying to use send object to email a report. The problem I am having is that the report will only mail once.

I have attached the code that I am using:

Code:
Private Sub Command42_Click()

DoCmd.SendObject acReport, "rptPharmacyOrder", "HTML (*.html)", PharmacyEmail, "", "", "Express - Refill Order", "Please refill the attached order", False, ""

End Sub

I do not understand why it is only mailing once. The code looks ok to me.

I am open to any suggestions.

Thanks,

John
 
I left one thing out. The send object command button is located on a sub form if that makes any difference.

John
 
What does the "PharmacyEmail" variable contain? Is it a colon-delimited list of email addresses?

VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
Hi and thanks for responding,

The PharmacyEmail variable comes from a table field. I am using this same type of setup in another part of the db and it works fine.

In this instance I am trying to email a report from a sub form that is getting it's data from a query.

I have a small variable built into the query to limit certain records based on a "Like" statement, which is:

Like [Original Order, First Refill, Second Refill]

I have a feeling that I am not doing something right in dealing with the query.

I can send the email only one time. If I exit the db and reopen it I can send it one time only. I think this tells me that the query is my problem.

Thank you for any help you can provide as it will also serve as a learning experience for me.

Take care,

John
 
johngordon, I'm not entirely sure, I understand How you implement the input, of the email addresses, but as VBSlammer said, the variable value, should be a "semi"-colon delimited list(string), of email addresses.

"laneDoe@Hotmail.com;Jondoe@sympatico.ca;bfraser@3web.net"

...Your like statement, looks questionable?

...txtAddress Like '234 Main*'"

..txtName Like 'D*'"
...txtCity Like 'Genève'"

good luck either way!
 
I always had a problem using code to send an object. The easiest thing to do, and I use it several times daily, is to write a macro to send object, it will ask you for the report name, send to, output format, and so on. Then put a button anywhere you want on your form. When you add the button you will be asked what you want the button to do, select run macro and choose the name of the send object macro. This is so fast and easy compared to all the code necessary to perform the function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top