473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SendObjects won't execute twice

I am a rank amateur and have taught myself enough to only just get away with some coding. I have now reached the limit of my capacity.
I am using MSAccess 2000 SR1 and am trying to use sendObjects to send a preformatted report in HTML format as an attachment to an email message.
The first time I perform this function (by way of button on a form) it works perfectly.
When I next try to do it (for a different record or the same record) it simply fails to execute. No error message or anything.
I am currently working around this by closing down Access and restarting it (works fine for one more message).

My code appears below:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command38_Click()
  2. On Error GoTo Err_Command38_Click
  3.  
  4.     Dim recipient, copies As String
  5.     Forms![Issue Status]![Customer].SetFocus
  6.     recipient = Me![Customer].Text
  7.     Forms![Issue Status]![InterestedParties].SetFocus
  8.     copies = Me![InterestedParties].Text
  9.     Dim subjecttext As String
  10.     Dim IssueRef As String
  11.     Dim DetailText As String
  12.     Forms![Issue Status]![Description].SetFocus
  13.     subjecttext = Me![Description].Text
  14.     Forms![Issue Status]![Issue Reference].SetFocus
  15.     IssueRef = Me![Issue Reference].Text
  16.     Forms![Issue Status]![Details].SetFocus
  17.     DetailText = Me![Details].Text
  18.  
  19.     DoCmd.SendObject acSendForm, "Issue Update All", acFormatHTML, _
  20.      recipient, copies, , _
  21.     "Issue Status Update: ( " & IssueRef & " ) " & subjecttext, "Detail: " & subjecttext & vbCrLf & DetailText & vbCrLf & vbCrLf & "Please find attached an update of this Issue", True
  22.     Forms![Issue Status]![Command38].SetFocus
  23. Exit_Command38_Click:
  24.     Exit Sub
  25.  
  26. Err_Command38_Click:
  27.     MsgBox Err.Description
  28.     Resume Exit_Command38_Click
  29.  
  30. End Sub
  31.  
Feb 27 '07 #1
3 1596
MMcCarthy
14,534 Expert Mod 8TB
All this will do is to send to the customer currently in focus. You will have to change the focus of the record to change the recipient. I've removed all the set focus commands as they are unnecessary.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command38_Click()
  2. On Error GoTo Err_Command38_Click
  3. Dim recipient, copies As String
  4. Dim subjecttext As String
  5. Dim IssueRef As String
  6.     Dim DetailText As String
  7.  
  8. recipient = Me![Customer]
  9. copies = Me![InterestedParties]
  10.  
  11. subjecttext = Me![Description]
  12. IssueRef = Me![Issue Reference]
  13. DetailText = Me![Details]
  14.  
  15.     DoCmd.SendObject acSendForm, "Issue Update All", acFormatHTML, _
  16.      recipient, copies, , _
  17.     "Issue Status Update: ( " & IssueRef & " ) " & subjecttext, "Detail: " & subjecttext & vbCrLf & DetailText & vbCrLf & vbCrLf & "Please find attached an update of this Issue", True
  18.  
  19. Exit_Command38_Click:
  20.     Exit Sub
  21.  
  22. Err_Command38_Click:
  23.     MsgBox Err.Description
  24.     Resume Exit_Command38_Click
  25.  
  26. End Sub
  27.  
Feb 27 '07 #2
Thanks for the cleanup, but the net result remains that the button will only work once.

Can you provide any advice as to how I reset whatever I need to reset in order to have it send a second message (either from the the same record or from another record) without having to close down Access and restart?
Mar 2 '07 #3
NeoPa
32,556 Expert Mod 16PB
Check this out (SendObject - only works once!).
Mar 2 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Adams-Blake Co. | last post by:
In table is record, field called CompanyName that has: Joe\'s Place (I added the slashes before inserting the field.) This will NOT work: $x="Joe's Place"; $sql="Select * from Company...
5
by: ano1optimist | last post by:
I'm using Access 2000 and have tried Access 2003 front-end to execute the stored procedure sp_password on SQL Server 2000. I continue to receive the following message: "The old (current) password...
14
by: tonyjeffs | last post by:
#include "stdafx.h" #include "stdafx.h" #include<iostream> #include <fstream> using namespace std; using std::cout; int main(int argc, char* argv)
1
by: sari | last post by:
does anybody know how to use the sendobjects command with an attached text file? Appreciate your help.
1
by: Lewis | last post by:
Hi, Im having a problem with an aspx page that I'm building (and rather urgently needing to complete!). Situation is this... Im transforming some XML using an XSLT which builds an HTML form...
4
by: Julia | last post by:
Hi Everyone, I am using webbrowser control to post data to an aspx page. However, for some reason, the aspx page sometimes will execute page_load event twice, and sometimes execute it once. So I...
1
by: bluebeta | last post by:
Hi, I am new to ASP .NET, I am using visual studio 2005 and ASP .NET 2.0.When I do a simple practical i find a strange problem on server button control. I have a web form with a few text boxes...
6
by: Amy | last post by:
Hello, I have an array with 60 items in it, one for every second, But when it gets to the end of the 60 items it stops. How do I get it to start over when it gets to the end of the array? Please...
1
by: Ernie13 | last post by:
Hi everybody, I've Googled some hours now to find a solution, but I'm really stuck. This is my situation: I have a <div id='content'> where the content is loaded with Ajax, and some buttons...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.