C
Caroline Higson
Hello
I have a command button to open Word 03 from Access 03, merge the
fields and then print them out. I only want the merge to print out the
latest record addition to the database, but it prints out every single
record in it. Is there any code I can input into my existing vb to do
this automatically?
Thank you very much,
Code as follows:
Private Sub Command42_Click()
Dim objWord As Object
Set objWord = GetObject("C:\Documents and Settings\Owner\My
Documents\welcome letter.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Rat Rescue database.
objWord.MailMerge.OpenDataSource _
Name:="C:\Documents and Settings\Owner\My
Documents\document.mdb", _
LinkToSource:=True, _
Connection:="TABLE Sponsors", _
SQLStatement:="SELECT * FROM [Sponsors]"
objWord.MailMerge.Destination = wdSendToNewDocument
objWord.MailMerge.Execute
objWord.Application.Options.PrintBackground = False
objWord.Application.ActiveDocument.PrintOut
End Sub
I have a command button to open Word 03 from Access 03, merge the
fields and then print them out. I only want the merge to print out the
latest record addition to the database, but it prints out every single
record in it. Is there any code I can input into my existing vb to do
this automatically?
Thank you very much,
Code as follows:
Private Sub Command42_Click()
Dim objWord As Object
Set objWord = GetObject("C:\Documents and Settings\Owner\My
Documents\welcome letter.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Rat Rescue database.
objWord.MailMerge.OpenDataSource _
Name:="C:\Documents and Settings\Owner\My
Documents\document.mdb", _
LinkToSource:=True, _
Connection:="TABLE Sponsors", _
SQLStatement:="SELECT * FROM [Sponsors]"
objWord.MailMerge.Destination = wdSendToNewDocument
objWord.MailMerge.Execute
objWord.Application.Options.PrintBackground = False
objWord.Application.ActiveDocument.PrintOut
End Sub