Knowing what you've printed (2)

G

Guest

Hi. I'm trying to tie together some of the very helpful responses from the
group, especially fredg.

Before our big fund-raising event, our non-profit solicits donations. We
gather names from past donors and from our members. I've created an access
database that tracks the donors/potential donors. We send out letters in
"batches"- when we get the names, essentially. So, I'm wondering how I keep
from sending the first batch of letters out everytime I send out the
following batch of letters.

fredg gave me some suggestions, but of course I didn't really know what I
wanted at the time!
fredg suggested that I add a field "DateSent". Then run a report which also
updates "DateSent":
Code the report's Declarations section and the Activate event and
GroupFooter Format events:
Option Compare Database
Option Explicit
Dim intPreview As Integer
---------------------
Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As
Integer)

If intPreview = 0 Then
Dim strSQL As String
strSQL = "Update YourTableName Set YourTableName.DateSent= #" _
& Date & "# Where YourTableName.[ID] = " & [ID] & ";"

CurrentDb.Execute strSQL, dbFailOnError
End If

End Sub
------------------------------
Private Sub Report_Activate()
intPreview = -1
End Sub

and then run the report for those entries that have the correct date:
Docmd.OpenReport, "Reportname",acViewNormal, , "[DateSent] Is Null Or
[DateSent] < DateSerial(Year(Date()),1,1)"

This does update the table nicely since fredg wrote it! But I'm not getting
an actual letter to send out.
Here's what I'd really like to do:
Mail merge a query to a MSWord letter (since I don't want to store the
letter or "report" in Access- and I believe I can do this myself!), based on
a user entered date (I have forms that I allow the user to select the date,
but don't know if/how to do it for a query, and don't want to "hard code" the
date in code if possible), and then update the table to show the sent date
for the letter.

Can it be done? Details most appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top