Hi. I have an Access DB that is for contracts. I have used the code found on Tony's site for emailing a report per person containing only their information using GroupWise. It works great but I have a problem. Right now, the code before the GroupWise code, generates reports based on time criteria. If the query has no records for a person then a report isn't created. Trouble is, the code for GroupWise email sends the auto email message even though there isn't an attachment. How can I tell it to not send the auto email message to a recipient if there isn't a report as an attachment? Thanks in advance. I've been trying to find an answer all morning!
46 3524 NeoPa 32,571
Recognized Expert Moderator MVP
To be honest, without having the code to reference it's going to be quite hard to know which bit(s) of it needs to be changed. Most things can be done in various ways in Access (Can be a blessing but can also be a chore) so there's really no way to guess.
Try posting the relevant section of the code (or all of it if it's not too voluminous).
MMcCarthy 14,534
Recognized Expert Moderator MVP
Hi. I have an Access DB that is for contracts. I have used the code found on Tony's site for emailing a report per person containing only their information using GroupWise. It works great but I have a problem. Right now, the code before the GroupWise code, generates reports based on time criteria. If the query has no records for a person then a report isn't created. Trouble is, the code for GroupWise email sends the auto email message even though there isn't an attachment. How can I tell it to not send the auto email message to a recipient if there isn't a report as an attachment? Thanks in advance. I've been trying to find an answer all morning!
Post the piece of code that runs the report and calls the groupwise function. It's a matter of deciding to ignore the latter line of code if the report has no records. Once we see the code it will give a better idea of how that can be done.
Mary
Here is the code for one person. Before this code runs, the DB creates a report, per person, if there is data. Looking forward to your help! I just can't figure it out! - Sub RunLRiouxEMail()
-
-
On Error GoTo Err_Handler
-
Dim strTemp As String
-
Dim varAttach(2) As Variant
-
Dim strRecTo(1, 0) As String
-
Dim strRecCc(1, 0) As String
-
Dim lngCount As Long
-
Dim varProxies As Variant
-
Dim cGW As GW
-
-
-
varAttach(0) = "C:\Documents and Settings\reo\My Documents\ContractReports\ReportsRioux.rtf"
-
-
strRecTo(0, 0) = "lmr@propeople.org"
-
strRecTo(1, 0) = "lmr@propeople.org"
-
-
strRecCc(0, 0) = "plm@propeople.org"
-
-
Set cGW = New GW
-
With cGW
-
.Login
-
.BodyText = "Attached please find a word document that lists: " & _
-
"contract reports that are over due and contract reports " & _
-
"that are due within one to three weeks. " & vbCrLf & vbCrLf & _
-
"Please ensure that the reports are completed and sent " & _
-
"to the contract officer on time. A copy of the dated cover " & _
-
"letter transmitting the report and the report itself should " & _
-
"be sent to the Accounting Specialist in the Finance Office. " & _
-
"The Accounting Specialist will update the Contracts database " & _
-
"with the date the report was submitted and file the report " & _
-
"in the contract file for the compliance audits." & vbCrLf & vbCrLf & _
-
"If no document is attached to this automated e-mail then " & _
-
"you have no past due reports and no reports due within " & _
-
"the next three weeks." & vbCrLf & vbCrLf & _
-
"For questions please contact the Accounting Specialist " & _
-
"at 874-1140 ext 356. Thank you."
-
.Subject = "Contract Reports"
-
.RecTo = strRecTo
-
.RecCc = strRecCc
-
.FileAttachments = varAttach
-
.FromText = "Finance Department"
-
.Priority = "High"
-
strTemp = .CreateMessage
-
.ResolveRecipients strTemp
-
If IsArray(.NonResolved) Then MsgBox "Some unresolved recipients."
-
.SendMessage strTemp
-
.DeleteMessage strTemp, True
-
End With
-
-
-
-
Exit_Here:
-
Set cGW = Nothing
-
Exit Sub
-
-
Err_Handler:
-
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical
-
Resume Exit_Here
-
-
End Sub
Here is the code that creates a report for one person. - DoCmd.OpenQuery "qryTimeToMailNoel", acNormal, acEdit
-
If DCount("*", "qryTimeToMailNoel") = 0 Then
-
DoCmd.Close acQuery, "qryTimeToMailNoel"
-
Else
-
DoCmd.OpenReport "rptReportsNoel", acPreview, "", ""
-
DoCmd.Close acReport, "rptReportsNoel"
-
DoCmd.Close acQuery, "qryTimeToMailNoel"
-
DoCmd.OutputTo acReport, "rptReportsNoel", _
-
"RichTextFormat(*.rtf)", _ "g:\accounting\development\ReportsNoel.rtf", _
-
False, ""
-
DoCmd.OutputTo acReport, "rptReportsNoel", _ "RichTextFormat(*.rtf)", _
-
"C:\Documents and Settings\reo\My Documents\ContractReports\ReportsNoel.rtf", _
-
False, ""
-
End If
MMcCarthy 14,534
Recognized Expert Moderator MVP
Here is the code that creates a report for one person. - DoCmd.OpenQuery "qryTimeToMailNoel", acNormal, acEdit
-
If DCount("*", "qryTimeToMailNoel") = 0 Then
-
DoCmd.Close acQuery, "qryTimeToMailNoel"
-
Else
-
DoCmd.OpenReport "rptReportsNoel", acPreview, "", ""
-
DoCmd.Close acReport, "rptReportsNoel"
-
DoCmd.Close acQuery, "qryTimeToMailNoel"
-
DoCmd.OutputTo acReport, "rptReportsNoel", _
-
"RichTextFormat(*.rtf)", _ "g:\accounting\development\ReportsNoel.rtf", _
-
False, ""
-
DoCmd.OutputTo acReport, "rptReportsNoel", _ "RichTextFormat(*.rtf)", _
-
"C:\Documents and Settings\reo\My Documents\ContractReports\ReportsNoel.rtf", _
-
False, ""
-
End If
Where is the line of code that actually calls the mailout function?
The one above is run by a macro which has another RunCode to run the following function - Function ROconnerMail()
-
Call RunROconnerEMail
-
End Function
This calls the following: - Sub RunROconnerEMail()
-
-
On Error GoTo Err_Handler
-
Dim strTemp As String
-
Dim varAttach(2) As Variant
-
Dim strRecTo(1, 0) As String
-
Dim strRecCc(1, 0) As String
-
Dim lngCount As Long
-
Dim varProxies As Variant
-
Dim cGW As GW
-
-
-
varAttach(0) = "C:\Documents and Settings\reo\My Documents\" & _
-
"ContractReports\ReportsOConnor.rtf"
-
-
strRecTo(0, 0) = "reo@propeople.org"
-
strRecTo(1, 0) = "reo@propeople.org"
-
-
strRecCc(0, 0) = "tpg@propeople.org"
-
-
Set cGW = New GW
-
With cGW
-
.Login
-
.BodyText = "Attached please find a word document that lists: " & _
-
"contract reports that are over due and contract reports " & _
-
"that are due within one to three weeks. " & vbCrLf & vbCrLf & _
-
"Please ensure that the reports are completed and sent " & _
-
"to the contract officer on time. A copy of the dated " & _
-
"cover letter transmitting the report and the report " & _
-
"itself should be sent to the Accounting Specialist in " & _
-
"the Finance Office. The Accounting Specialist will " & _
-
"update the Contracts database with the date the report " & _
-
"was submitted and file the report in the contract file " & _
-
"for the compliance audits." & vbCrLf & vbCrLf & _
-
"If no document is attached to this automated e-mail " & _
-
"then you have no past due reports and no reports due " & _
-
"within the next three weeks." & vbCrLf & vbCrLf & _
-
"For questions please contact the Accounting Specialist " & _
-
"at 874-1140 ext 356. Thank you."
-
.Subject = "Contract Reports"
-
.RecTo = strRecTo
-
.RecCc = strRecCc
-
.FileAttachments = varAttach
-
.FromText = "Finance Department"
-
.Priority = "High"
-
strTemp = .CreateMessage
-
.ResolveRecipients strTemp
-
If IsArray(.NonResolved) Then MsgBox "Some unresolved recipients."
-
.SendMessage strTemp
-
.DeleteMessage strTemp, True
-
End With
-
-
-
-
Exit_Here:
-
Set cGW = Nothing
-
Exit Sub
I appreciate the time you are spending as this is getting really frustrating; anything I try doesn't work.
NeoPa 32,571
Recognized Expert Moderator MVP
Pixie,
If you post code without the tags (as it instructs you to do in the Reply window) then anyone trying to help you will find it difficult to understand what you're doing or what your code is doing. I've fixed up your earlier posts for you but the underlying code is not laid out for reading. If I fix this last one up it's just going to hide most of the info as some of the lines are so long (.BodyText=...) . If you want the help then please at least don't make things harder for those who try to give it. I will go through your last post now trying to make it readable, but please, in future, include the tags and lay the code out in a way that is easily read.
MODERATOR.
I'm sorry. I will review the guidelines and comply in the future.
NeoPa 32,571
Recognized Expert Moderator MVP
That was a quick response :)
I don't mean to sound heavy, but it can cause a lot of delays sometimes.
I actually enjoyed going through your code though. It's a shame I don't have that level of experience with the objects that drive MS Outlook - but that's another story...
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Atim |
last post by:
I'm trying to create an email message in Novell Groupwise (from
Access) which the user can edit before sending. Using the code below,
I can create a message just fine, but the problem is that it gets sent
out automatically, which is not what I want. If I comment out the
Call Message.Send part of the code, it stores the message in the Work
in Progress Folder, which is great - but it deletes all the
recipients' addresses in the "TO:"...
|
by: acewood1 |
last post by:
I've done some searching in the archives but can't seem to find an easy
answer as to how to send a Groupwise email through Access 2003. I just
need to open a new email and populate the "To:" line with the email
address on a form. In Access 97 this simple line on a command button
got the job done.
DoCmd.SendObject , "", "", Me.txtEmail, "", "", "", "", True, ""
I've been to Dev Ashish's site and saw the code written by Dimitri...
|
by: amjad |
last post by:
hi how to send email through groupwise not smtp with asp.net 1.1 lang=c sharp..
thanks
|
by: mcsheepie |
last post by:
Hi
I've been happily using Dimitri Furman's email code to send messages but since upgrading to Groupwise 7 i've hit a slight problem. The code works great and sends the email as expected, however if you specify a proxy account to send the message from it does this, sends the email and then Access crashes (generic, Access has encountered and error message). I can't seem to find out where its crashing, no error messages etc, debugging doesn't...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |