By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 936 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Add Current Date To Table After Mail Merge

P: n/a
Hi Everyone,

Access 2000

I have some code behind a button that performs a word merge with a query
data source. The merge works fine. But what I'd like to do somehow is
after the merge is generated (or before), assign the current date to the
[LetterDate] field in the main table [tblAdm] the query data source is based
on. Is this even possible? If so, how could I do it? Here is the code
that works so far:

Private Sub cmdLetter_Click()
Dim objWord As Word.Document
Set objWord = GetObject("K:\DATA\Letter.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source.
objWord.MailMerge.OpenDataSource Name:="K:\DATA\ADM.mdb",
LinkToSource:=True, Connection:="QUERY qryLetter"
' Execute the mail merge.
objWord.MailMerge.Execute
End Sub

Thanks for your help,

William
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
The simplest way would be to design an update query and run the query after
the merge is complete. In the update query just add the [LetterDate] field
to the design grid. Select the main menu/Query/Update Query option. In the
Update To: type in "Date() " (no quotes). If your query is called
qupdLetterDate add the following to the end of your procedure:
Private Sub cmdLetter_Click()
Dim objWord As Word.Document
Set objWord = GetObject("K:\DATA\Letter.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source.
objWord.MailMerge.OpenDataSource Name:="K:\DATA\ADM.mdb",
LinkToSource:=True, Connection:="QUERY qryLetter"
' Execute the mail merge.
objWord.MailMerge.Execute
DoCmd.OpenQuery "qupdLetterDate", acNormal, acEdit
End Sub
If you only want to add today's date to new records open the table that
contains the LetterDate field and set the Default value to Date().

Hope this helps!
--
Reggie

www.smittysinet.com
----------
"William Wisnieski" <ww********@admissions.umass.edu> wrote in message
news:40********@news-1.oit.umass.edu... Hi Everyone,

Access 2000

I have some code behind a button that performs a word merge with a query
data source. The merge works fine. But what I'd like to do somehow is
after the merge is generated (or before), assign the current date to the
[LetterDate] field in the main table [tblAdm] the query data source is based on. Is this even possible? If so, how could I do it? Here is the code
that works so far:

Private Sub cmdLetter_Click()
Dim objWord As Word.Document
Set objWord = GetObject("K:\DATA\Letter.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source.
objWord.MailMerge.OpenDataSource Name:="K:\DATA\ADM.mdb",
LinkToSource:=True, Connection:="QUERY qryLetter"
' Execute the mail merge.
objWord.MailMerge.Execute
End Sub

Thanks for your help,

William

Nov 12 '05 #2

P: n/a
Thanks for your help....that works!
"Reggie" <no**********@smittysinet.com> wrote in message
news:6Y********************@comcast.com...
The simplest way would be to design an update query and run the query after the merge is complete. In the update query just add the [LetterDate] field to the design grid. Select the main menu/Query/Update Query option. In the Update To: type in "Date() " (no quotes). If your query is called
qupdLetterDate add the following to the end of your procedure:
Private Sub cmdLetter_Click()
Dim objWord As Word.Document
Set objWord = GetObject("K:\DATA\Letter.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source.
objWord.MailMerge.OpenDataSource Name:="K:\DATA\ADM.mdb",
LinkToSource:=True, Connection:="QUERY qryLetter"
' Execute the mail merge.
objWord.MailMerge.Execute


DoCmd.OpenQuery "qupdLetterDate", acNormal, acEdit
End Sub


If you only want to add today's date to new records open the table that
contains the LetterDate field and set the Default value to Date().

Hope this helps!
--
Reggie

www.smittysinet.com
----------
"William Wisnieski" <ww********@admissions.umass.edu> wrote in message
news:40********@news-1.oit.umass.edu...
Hi Everyone,

Access 2000

I have some code behind a button that performs a word merge with a query
data source. The merge works fine. But what I'd like to do somehow is
after the merge is generated (or before), assign the current date to the
[LetterDate] field in the main table [tblAdm] the query data source is

based
on. Is this even possible? If so, how could I do it? Here is the code
that works so far:

Private Sub cmdLetter_Click()
Dim objWord As Word.Document
Set objWord = GetObject("K:\DATA\Letter.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source.
objWord.MailMerge.OpenDataSource Name:="K:\DATA\ADM.mdb",
LinkToSource:=True, Connection:="QUERY qryLetter"
' Execute the mail merge.
objWord.MailMerge.Execute
End Sub

Thanks for your help,

William


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.