Reply
 
Thread Tools Display Modes
  #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

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default Need help merging current record.

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

"oakleyp2" wrote in message
news

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



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


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


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

  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default Need help merging current record.

But where in your code do you be select a particular record?

See the following page of Bill Gate's look-a-like website at:

http://www.members.shaw.ca/AlbertKal...rge/index.html

--
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

"oakleyp2" wrote in message
news

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


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



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging labels from excel starts second page with second record Debbie Mailmerge 1 February 8th 06 07:17 PM
"Next Record If", Mail Merge Issues [email protected] Mailmerge 8 February 8th 06 07:11 PM
Next Record If, problems with merging multiple records [email protected] Mailmerge 0 January 13th 06 04:38 PM
Conditional record merging not working in Word 2003 Carey G Mailmerge 2 January 9th 06 07:31 PM
Merging an access record or query to a word doc amiga1200 Mailmerge 3 June 1st 05 12:08 PM


All times are GMT +1. The time now is 02:38 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright İ2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"