View Single Post
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
oakleyp2
 
Posts: n/a
Default Need help merging current record.


I would have done a search in the forum but didnt see anyway to do it.

my code below will work if i leave out:
With DataSource
.FirstRecord = Forms!frmGNOA.CurrentRecord
.LastRecord = Forms!frmAGNOA.CurrentRecord
End With

but it does not pull the current record it only gets the first one and
merges it. what do i need to change to make it get the current record
to merge???


Set oApp = CreateObject("Word.Application")

oApp.Visible = True

Set oDoc = oApp.Documents.Add(conagnoa)

oDoc.MailMerge.OpenDataSource Name:="C:\re\support.mdb", _
Connection:="TABLE tblAGNOA", SQLStatement:="SELECT * FROM [tblAGNOA]"

With oDoc.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True

With DataSource
.FirstRecord = Forms!frmGNOA.CurrentRecord
.LastRecord = Forms!frmAGNOA.CurrentRecord
End With

.Execute pause:=True

End With

oDoc.Close savechanges:=wdDoNotSaveChanges
oApp.ScreenUpdating = True


--
oakleyp2
Posted from - http://www.officehelp.in