Local group [club] membership renewal by email, not post? (1 Viewer)

Well your flags need to determine if you should create the pdf in the first place?
Then in the Outlook part, they should also determine if they need to be added. You cannot add a file if it does not exist.

All done with a simple If and End If. I would probably use those same flags to determine what I need to delete after sending the email, or you could give them all unique names with perhaps the member ID, then delete them all from that folder right at the end of the procedure.

Daniel was not aware of the other options, so a fair bit needs to be amended to handle all three reports, subject etc?

As he stated
I hadn't seen your post [this above] before I posted my last.
Yes, not fair on Daniel, really. I probably should have insisted on telling mike more about what was required before he started his work.
 
Yes, not fair on Daniel, really. I probably should have insisted on telling mike more about what was required before he started his work.
I seriously doubt it would have made a difference. :(
 
Please use code tags when posting code. It keeps the indentation and make it easier to read.
Use the </> icon
 
Can I simply repeat this " If Else End If " (with changed references and content, of course.) ?
I would say NO. You just need a simple IF & End If to determine what you are sending. If you are ALWAYS sending A, then no need to test for that, just B & C.
You need to actually understand the logic, not just throw a bunch of code together without knowing what it does. That never works until someone corrects it. :(
 
Can anyone suggest why I'm not getting a response to registration from UtterAccess?
Does it usually take a while to get a 'registered' confirmation email from them?
I registered 2-3 hrs ago, and no sign yet.
I've contacted you by PM. As an Admin at UtterAccess I can help complete the registration. I need the exact username you want to register under.
 
I hadn't seen your post [this above] before I posted my last.
Yes, not fair on Daniel, really. I probably should have insisted on telling mike more about what was required before he started his work.

What field holds the flag to create your second attachment? Also, you will want to remove the spaces in your field names.

Were it me, I'd be building your subject line and email body based on your flags. Think through what pieces you want in the subject. This means you may have something that looks like

strSubject = "My Organization Name would like to thank you for your renewal "
IF rstClone.[Gift Aid] = TRUE THEN strSubject = strSubject & "and generous gift"
IF rstClone.[OtherFlag] = TRUE THEN strSubject = strSubject & " and the blessing you have bestowed upon Arioch"

You can then have your code for adding attachments be
.Attachments.Add strFileNameRenewal 'We ALWAYS send the renewal
IF rstClone.[Gift Aid] = TRUE THEN .Attachments.Add strFileNameGiftAid 'If there is a gift aid, send that to.
IF rstClone.[OtherFlag] = TRUE THEN .Attachments.Add strFileNameArioch 'If the other flag is sent, summon Arioch from the end of time.

Does this make sense to you? Different approach, but I prefer something I can easily modify without needing to add a lot of butter and parmesan to. 😁
 
What field holds the flag to create your second attachment? Also, you will want to remove the spaces in your field names.

Were it me, I'd be building your subject line and email body based on your flags. Think through what pieces you want in the subject. This means you may have something that looks like

strSubject = "My Organization Name would like to thank you for your renewal "
IF rstClone.[Gift Aid] = TRUE THEN strSubject = strSubject & "and generous gift"
IF rstClone.[OtherFlag] = TRUE THEN strSubject = strSubject & " and the blessing you have bestowed upon Arioch"

You can then have your code for adding attachments be
.Attachments.Add strFileNameRenewal 'We ALWAYS send the renewal
IF rstClone.[Gift Aid] = TRUE THEN .Attachments.Add strFileNameGiftAid 'If there is a gift aid, send that to.
IF rstClone.[OtherFlag] = TRUE THEN .Attachments.Add strFileNameArioch 'If the other flag is sent, summon Arioch from the end of time.

Does this make sense to you? Different approach, but I prefer something I can easily modify without needing to add a lot of butter and parmesan to. 😁
Both the Gift Aid and Standing Order attachments ( referred to elsewhere as B & C) are governed by boolean fields.
If a member is not signed up, there is no check mark, and the attachment is[are] sent to encourage doing it.

The code I have looks [to me!] quite different to yours, but I believe does the same. There are defined strings for the text in the subject line of all three different emails [depending on attachments A, B, C]
And likewise different text strings for the body of the email for A, B and C.
Emails are created with either just A, or A and B as appropriate.
I just need to edit the code to enable C to be sent when necessary.

(And, in due course, remove all spaces from field names, for a start!)

Thanks for your interest.
 
I would be constructing the email body depending on what is attached.
 

Attachments

  • Renewal & GA.jpg
    Renewal & GA.jpg
    49.2 KB · Views: 6
  • Renewal only.jpg
    Renewal only.jpg
    39.4 KB · Views: 6
Thanks to the code from Daniel Pineault this is working very well with one 'fly in the ointment'.
This correctly generates a gift aid form if a member's record for [Gift aid] is false.
Code:
            If rstClone![Gift Aid] = 0 Then
                strSubject = strSubjectGiftAid
                strMsg = strMsgGiftAid

                'Gift Aid Report Only Included If Selected
                strFileNameGiftAid = "C:\Emails\" & Format(Date, "yyyy_mm_dd") & "- Gift Aid -" & rstClone!MemberNo & ".pdf"
                Call GeneratePDFofReport(sReportNameGiftAid, strFileNameGiftAid, strWhere)
            Else
                strSubject = strSubjectRenewal
                strMsg = strMsgRenewal
            End If
The member's record also has a boolean for [Gift Aid Decline] ((Yes, I know, spaces in a field name!!))
and where that is true, I want to prevent the pdf being generated.
I am sure the logic required is very basic, but i'm not at all sure what it should be.
Would someone please educate me?
PS if you want to see the whole code, let me know, it just seemed rather OTT.
 
This correctly generates a gift aid form if a member's record for [Gift aid] is false.
That seems ass backwards to me? The original code was doing it the other way?
Just check the Decline flag as well.
 
That seems ass backwards to me? The original code was doing it the other way?
Just check the Decline flag as well.
In english, it goes like this: they have signed up for GA so we put in a tick.
Equally, if they have stated they do not want to get involved, a tick goes in 'declined'

The code hasn't been changed and works as intended.

I just need guidance on the VBA way of saying:
if not signed up, and having said "no i wont sign up", don't generate.
It's the bit in italics that the code doesn't do yet.
 
Why not just have GiftAId as False to indicate they have not signed up?
Basically you write what you have just expressed in English using an AND in testing your declined flag.
I hope you have a check to make sure they cannot conflict with each other?
 
@John,

In your Else, add another IF / THEN / ELSE to cover having your other flag set.
You would then have to declare and create the correct strMsgGiftAidDecline up top where your already creating strMsgGiftAid, but then you can just use StrMsgGiftAidDecline instead of strMstGiftAid.

You already have a working example, so I'd do a little reading on both how to declare variables as well as how to use If/Then/Else in VBA so you are comfortable doing this change yourself.
 
Why not just have GiftAId as False to indicate they have not signed up?
Basically you write what you have just expressed in English using an AND in testing your declined flag.
I hope you have a check to make sure they cannot conflict with each other?
"Why not..." well it does indicate just that, but that may be because some folk haven't got around to it or didn't consider it etc etc,
The Declined is when some one specifically says they don't want to (and we have to assume they won't in the future, so we don't want to bug them with unwanted Gift Aid forms. It's about getting the computer to treat our members as humans.
Thanks for the AND suggestion.
I hope so too, but doubt it. Remember I inherited this behemoth from a user-creator. :( But I will see about implementing it. Good call. (There's lots of work of that nature to be done. )
 
So you have three states?

1. They have yet to be asked about Gift Aid
2. They have been asked and have agreed to sign up
3. They have been asked and have declined

For 2, send them the gift aid form.
For 3, do not send them the gift aid form
For 1, what do you want to do?

Really this data belongs in a separate table, not in the Contacts table (though you can leave it there if you're lazy!)

In a linked table you could record the ContactID as a foreign key, the date of request and their response.

If the ContactID is not present then they haven't been asked yet. If it is there then you know when they were asked and also whether they want to do it or not.

If you leave it in the Contacts table then a Null value for DateAsked would indicate that they have yet to be asked and a boolean field can indicate their response.
 

Users who are viewing this thread

Back
Top Bottom