Need help merging current record.

O

oakleyp2

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 an
merges it. what do i need to change to make it get the current recor
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 = Tru
 
D

Doug Robbins - Word MVP

Why would the current record be anything other than the first record?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
O

oakleyp2

If you have a table that has like 15 records and you want to merge onl
the 5th one
 

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