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!
Jan 30 '07
46 3530
Thanks. I hope you or someone will be able to help me out. I tried doing - If varAttach(0).Count = O Then vbCancel Send End if
byt that didn't work. I am not sure what left to try. Looking forward to a response.
NeoPa 32,572
Recognized Expert Moderator MVP
The first thing you need to do is to determine what recognisable situation occurs when there are no items in your report. Does it fail to produce a file or does it produce a very small one. When you know that, we can look at ways of determining whether or not that state can be recognised by your code.
If there is no data, a report is not created and thus not saved in the folder. The folder gets cleaned out after each email run.
NeoPa 32,572
Recognized Expert Moderator MVP
That, we can work with.
It involves using Dir() but I'll have to look into it a bit before answering properly.
NeoPa 32,572
Recognized Expert Moderator MVP
Our first step is to put the following code in a general Module in your database. - Option Compare Database
-
Option Explicit
-
-
'Exist returns true if strFile exists.
-
'22/05/2003 Rewritten with better code.
-
'20/05/2005 Added finding of R/O, System & Hidden files
-
Public Function Exist(strFile As String, _
-
Optional intAttrib As Integer = &H7) As Boolean
-
Exist = (Dir(PathName:=strFile, Attributes:=intAttrib) <> "")
-
End Function
NeoPa 32,572
Recognized Expert Moderator MVP
Working from the code you posted in post #7... - 'Line added
-
Private Const conFile As String = _
-
"C:\Documents and Settings\reo\My Documents\" & _
-
"ContractReports\ReportsOConnor.rtf"
-
-
Function ROconnerMail()
-
'Line changed
-
If Exist(conFile) Then Call RunROconnerEMail(strFile:=conFile)
-
End Function
-
-
'Line changed
-
Sub RunROconnerEMail(ByRef strFile As String)
-
-
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
-
-
'Line changed
-
varAttach(0) = strFile
-
-
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
OK. I have it in the General Module as its own module. What next? Boy, do I really appreciate all your attention and help.
NeoPa 32,572
Recognized Expert Moderator MVP
I hope you refreshed after posting and saw the other posts ;)
Good morning. I was in a meeting yesterday afternoon (a rare thing for me) so didn't see the rest of your reply till late. I just added it but for some reason I can't run it. Should the first two line changes go in a new module?
NeoPa 32,572
Recognized Expert Moderator MVP
I'm a bit confused by the last bit (your question).
Where do you have the code currently (Module names and Types pls)? What is the name of the form you're working in?
There is some flexibility here as to where things can go, so if I know what you have where, I can better explain where it would be easiest for you to put the changes.
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |