Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MTechG
 
Posts: n/a
Default Populate Table from Access

I've got a template document I'm setting up and would like to populate a
table from Access. I already populated fields inside the template from
Access with VBA. Using Word/Access XP

Any hints?

TIA
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default Populate Table from Access

What do you want to populate the table with? - Data from a single record? -
Data from Multiple Records? - Data from all of the Records? - of just some
of them? If the latter, what is the criteria for selecting the ones from
which the data is to be used?

Sorry, more questions than answers.

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

"MTechG" wrote in message
...
I've got a template document I'm setting up and would like to populate a
table from Access. I already populated fields inside the template from
Access with VBA. Using Word/Access XP

Any hints?

TIA



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MTechG
 
Posts: n/a
Default Populate Table from Access

Doug

I'm looking to populate the table with multiple records for a query. I
tried mail merge and I have six records that are in the query now and I add
the field project in the table and the document is created six times. From
what I've been reading I believe it can be done in mail merge it's just I'm
doing something wrong.

Dennis

"Doug Robbins - Word MVP" wrote:

What do you want to populate the table with? - Data from a single record? -
Data from Multiple Records? - Data from all of the Records? - of just some
of them? If the latter, what is the criteria for selecting the ones from
which the data is to be used?

Sorry, more questions than answers.

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

"MTechG" wrote in message
...
I've got a template document I'm setting up and would like to populate a
table from Access. I already populated fields inside the template from
Access with VBA. Using Word/Access XP

Any hints?

TIA




  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default Populate Table from Access

Why not use an Access Report?

Sounds like you are probably trying to perform a "multiple items per
condition (=key field)" mailmerge which Word does not really have the
ability to do:

See the "Group Multiple items for a single condition" item on fellow MVP
Cindy Meister's website at

http://homepage.swissonline.ch/cindy...faq1.htm#DBPic


Or take a look at the following Knowledge Base Articles

http://support.microsoft.com/default...b;en-us;302665


http://support.microsoft.com/default...b;en-us;294686

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

"MTechG" wrote in message
...
Doug

I'm looking to populate the table with multiple records for a query. I
tried mail merge and I have six records that are in the query now and I
add
the field project in the table and the document is created six times.
From
what I've been reading I believe it can be done in mail merge it's just
I'm
doing something wrong.

Dennis

"Doug Robbins - Word MVP" wrote:

What do you want to populate the table with? - Data from a single
record? -
Data from Multiple Records? - Data from all of the Records? - of just
some
of them? If the latter, what is the criteria for selecting the ones from
which the data is to be used?

Sorry, more questions than answers.

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

"MTechG" wrote in message
...
I've got a template document I'm setting up and would like to populate
a
table from Access. I already populated fields inside the template from
Access with VBA. Using Word/Access XP

Any hints?

TIA






  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MTechG
 
Posts: n/a
Default Populate Table from Access

Doug

Thanks for those links I'm looking into them now. I wish I could use a
report but the template that I'm populating is for a Quoting system so there
is a lot of text to add and each one is different.

I'm looking at the compound merge right now. What I was thinking about was
maybe a looping scenario to populate the table on the fly. Create the table
based on knowing how many rows and columns and insert the data using the loop
and offsets. I've done something like this in Excel but Word is a different
animal.

I'm going to look at creating a table on the fly in a Word Document knowing
how big the table needs to be.

The loop would be my next step which is probably going to be the toughest
part of the whole thing.

Let me know what you think about this scenario if it's worth attempting I
think it is but I don't have a lot of experience with coding with Word.

TIA



"Doug Robbins - Word MVP" wrote:

Why not use an Access Report?

Sounds like you are probably trying to perform a "multiple items per
condition (=key field)" mailmerge which Word does not really have the
ability to do:

See the "Group Multiple items for a single condition" item on fellow MVP
Cindy Meister's website at

http://homepage.swissonline.ch/cindy...faq1.htm#DBPic


Or take a look at the following Knowledge Base Articles

http://support.microsoft.com/default...b;en-us;302665


http://support.microsoft.com/default...b;en-us;294686

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

"MTechG" wrote in message
...
Doug

I'm looking to populate the table with multiple records for a query. I
tried mail merge and I have six records that are in the query now and I
add
the field project in the table and the document is created six times.
From
what I've been reading I believe it can be done in mail merge it's just
I'm
doing something wrong.

Dennis

"Doug Robbins - Word MVP" wrote:

What do you want to populate the table with? - Data from a single
record? -
Data from Multiple Records? - Data from all of the Records? - of just
some
of them? If the latter, what is the criteria for selecting the ones from
which the data is to be used?

Sorry, more questions than answers.

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

"MTechG" wrote in message
...
I've got a template document I'm setting up and would like to populate
a
table from Access. I already populated fields inside the template from
Access with VBA. Using Word/Access XP

Any hints?

TIA








  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default Populate Table from Access

It is definitely possible using vba.

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

"MTechG" wrote in message
...
Doug

Thanks for those links I'm looking into them now. I wish I could use a
report but the template that I'm populating is for a Quoting system so
there
is a lot of text to add and each one is different.

I'm looking at the compound merge right now. What I was thinking about
was
maybe a looping scenario to populate the table on the fly. Create the
table
based on knowing how many rows and columns and insert the data using the
loop
and offsets. I've done something like this in Excel but Word is a
different
animal.

I'm going to look at creating a table on the fly in a Word Document
knowing
how big the table needs to be.

The loop would be my next step which is probably going to be the toughest
part of the whole thing.

Let me know what you think about this scenario if it's worth attempting I
think it is but I don't have a lot of experience with coding with Word.

TIA



"Doug Robbins - Word MVP" wrote:

Why not use an Access Report?

Sounds like you are probably trying to perform a "multiple items per
condition (=key field)" mailmerge which Word does not really have the
ability to do:

See the "Group Multiple items for a single condition" item on fellow MVP
Cindy Meister's website at

http://homepage.swissonline.ch/cindy...faq1.htm#DBPic


Or take a look at the following Knowledge Base Articles

http://support.microsoft.com/default...b;en-us;302665


http://support.microsoft.com/default...b;en-us;294686

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

"MTechG" wrote in message
...
Doug

I'm looking to populate the table with multiple records for a query. I
tried mail merge and I have six records that are in the query now and I
add
the field project in the table and the document is created six times.
From
what I've been reading I believe it can be done in mail merge it's just
I'm
doing something wrong.

Dennis

"Doug Robbins - Word MVP" wrote:

What do you want to populate the table with? - Data from a single
record? -
Data from Multiple Records? - Data from all of the Records? - of just
some
of them? If the latter, what is the criteria for selecting the ones
from
which the data is to be used?

Sorry, more questions than answers.

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

"MTechG" wrote in message
...
I've got a template document I'm setting up and would like to
populate
a
table from Access. I already populated fields inside the template
from
Access with VBA. Using Word/Access XP

Any hints?

TIA








  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MTechG
 
Posts: n/a
Default Populate Table from Access

Doug

Just finished up my Create Custom Table Sub and now going to brain storm on
looping through and pasting values into the table. Have you done anything
like this? I notice your name quite a bit when I search in Google groups
looking at code samples.

Dennis

"Doug Robbins - Word MVP" wrote:

It is definitely possible using vba.

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

"MTechG" wrote in message
...
Doug

Thanks for those links I'm looking into them now. I wish I could use a
report but the template that I'm populating is for a Quoting system so
there
is a lot of text to add and each one is different.

I'm looking at the compound merge right now. What I was thinking about
was
maybe a looping scenario to populate the table on the fly. Create the
table
based on knowing how many rows and columns and insert the data using the
loop
and offsets. I've done something like this in Excel but Word is a
different
animal.

I'm going to look at creating a table on the fly in a Word Document
knowing
how big the table needs to be.

The loop would be my next step which is probably going to be the toughest
part of the whole thing.

Let me know what you think about this scenario if it's worth attempting I
think it is but I don't have a lot of experience with coding with Word.

TIA



"Doug Robbins - Word MVP" wrote:

Why not use an Access Report?

Sounds like you are probably trying to perform a "multiple items per
condition (=key field)" mailmerge which Word does not really have the
ability to do:

See the "Group Multiple items for a single condition" item on fellow MVP
Cindy Meister's website at

http://homepage.swissonline.ch/cindy...faq1.htm#DBPic


Or take a look at the following Knowledge Base Articles

http://support.microsoft.com/default...b;en-us;302665


http://support.microsoft.com/default...b;en-us;294686

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

"MTechG" wrote in message
...
Doug

I'm looking to populate the table with multiple records for a query. I
tried mail merge and I have six records that are in the query now and I
add
the field project in the table and the document is created six times.
From
what I've been reading I believe it can be done in mail merge it's just
I'm
doing something wrong.

Dennis

"Doug Robbins - Word MVP" wrote:

What do you want to populate the table with? - Data from a single
record? -
Data from Multiple Records? - Data from all of the Records? - of just
some
of them? If the latter, what is the criteria for selecting the ones
from
which the data is to be used?

Sorry, more questions than answers.

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

"MTechG" wrote in message
...
I've got a template document I'm setting up and would like to
populate
a
table from Access. I already populated fields inside the template
from
Access with VBA. Using Word/Access XP

Any hints?

TIA









  #8   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP
 
Posts: n/a
Default Populate Table from Access

This code will add a table to the document at the location of the selection
(or some other range object) and populate it with data from the records in
the table in the database. It is necessary to set a reference in the Visual
Basic Editor (ToolsReference) to the Microsoft DAO #.# Object Library for
it to work.

Dim myDataBase As Database
Dim myActiveRecord As Recordset
Dim i As Long
Dim dtable As Table, drow As Row
'Open a database
Set myDataBase = OpenDatabase("c:\Access\Procurement Plan.mdb") 'use your
own database
'Access the first record from a particular table
Set myActiveRecord = myDataBase.OpenRecordset("Currencies",
dbOpenForwardOnly) 'use your own table
'Add a table to the document with one row and as many fields as there are in
the database table
Set dtable = ActiveDocument.Tables.Add(Range:=Selection.Range, NumRows:=1,
numcolumns:=myActiveRecord.Fields.Count)
Set drow = dtable.Rows(1)
'Loop through all the records in the table until the end-of-file marker is
reached
Do While Not myActiveRecord.EOF
'Populate the cells in the Word table with the data from the current
record
For i = 1 To myActiveRecord.Fields.Count
drow.Cells(i).Range.Text = myActiveRecord.Fields(i - 1)
Next i
'Add a new row to the Word table and access the next record
Set drow = dtable.Rows.Add
myActiveRecord.MoveNext
Loop
'The last row will be empty, so delete it
drow.Delete
'Then close the database
myActiveRecord.Close
myDataBase.Close

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

"MTechG" wrote in message
...
Doug

Just finished up my Create Custom Table Sub and now going to brain storm
on
looping through and pasting values into the table. Have you done anything
like this? I notice your name quite a bit when I search in Google groups
looking at code samples.

Dennis

"Doug Robbins - Word MVP" wrote:

It is definitely possible using vba.

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

"MTechG" wrote in message
...
Doug

Thanks for those links I'm looking into them now. I wish I could use a
report but the template that I'm populating is for a Quoting system so
there
is a lot of text to add and each one is different.

I'm looking at the compound merge right now. What I was thinking about
was
maybe a looping scenario to populate the table on the fly. Create the
table
based on knowing how many rows and columns and insert the data using
the
loop
and offsets. I've done something like this in Excel but Word is a
different
animal.

I'm going to look at creating a table on the fly in a Word Document
knowing
how big the table needs to be.

The loop would be my next step which is probably going to be the
toughest
part of the whole thing.

Let me know what you think about this scenario if it's worth attempting
I
think it is but I don't have a lot of experience with coding with Word.

TIA



"Doug Robbins - Word MVP" wrote:

Why not use an Access Report?

Sounds like you are probably trying to perform a "multiple items per
condition (=key field)" mailmerge which Word does not really have the
ability to do:

See the "Group Multiple items for a single condition" item on fellow
MVP
Cindy Meister's website at

http://homepage.swissonline.ch/cindy...faq1.htm#DBPic


Or take a look at the following Knowledge Base Articles

http://support.microsoft.com/default...b;en-us;302665


http://support.microsoft.com/default...b;en-us;294686

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

"MTechG" wrote in message
...
Doug

I'm looking to populate the table with multiple records for a query.
I
tried mail merge and I have six records that are in the query now
and I
add
the field project in the table and the document is created six
times.
From
what I've been reading I believe it can be done in mail merge it's
just
I'm
doing something wrong.

Dennis

"Doug Robbins - Word MVP" wrote:

What do you want to populate the table with? - Data from a single
record? -
Data from Multiple Records? - Data from all of the Records? - of
just
some
of them? If the latter, what is the criteria for selecting the
ones
from
which the data is to be used?

Sorry, more questions than answers.

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

"MTechG" wrote in message
...
I've got a template document I'm setting up and would like to
populate
a
table from Access. I already populated fields inside the
template
from
Access with VBA. Using Word/Access XP

Any hints?

TIA











  #9   Report Post  
Posted to microsoft.public.word.mailmerge.fields
MTechG
 
Posts: n/a
Default Populate Table from Access

Doug

Thanks a bunch for your help on this issue. I'm pretty much on the same
track as your code. I will use it as a refernce though.

Dennis

"Doug Robbins - Word MVP" wrote:

This code will add a table to the document at the location of the selection
(or some other range object) and populate it with data from the records in
the table in the database. It is necessary to set a reference in the Visual
Basic Editor (ToolsReference) to the Microsoft DAO #.# Object Library for
it to work.

Dim myDataBase As Database
Dim myActiveRecord As Recordset
Dim i As Long
Dim dtable As Table, drow As Row
'Open a database
Set myDataBase = OpenDatabase("c:\Access\Procurement Plan.mdb") 'use your
own database
'Access the first record from a particular table
Set myActiveRecord = myDataBase.OpenRecordset("Currencies",
dbOpenForwardOnly) 'use your own table
'Add a table to the document with one row and as many fields as there are in
the database table
Set dtable = ActiveDocument.Tables.Add(Range:=Selection.Range, NumRows:=1,
numcolumns:=myActiveRecord.Fields.Count)
Set drow = dtable.Rows(1)
'Loop through all the records in the table until the end-of-file marker is
reached
Do While Not myActiveRecord.EOF
'Populate the cells in the Word table with the data from the current
record
For i = 1 To myActiveRecord.Fields.Count
drow.Cells(i).Range.Text = myActiveRecord.Fields(i - 1)
Next i
'Add a new row to the Word table and access the next record
Set drow = dtable.Rows.Add
myActiveRecord.MoveNext
Loop
'The last row will be empty, so delete it
drow.Delete
'Then close the database
myActiveRecord.Close
myDataBase.Close

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

"MTechG" wrote in message
...
Doug

Just finished up my Create Custom Table Sub and now going to brain storm
on
looping through and pasting values into the table. Have you done anything
like this? I notice your name quite a bit when I search in Google groups
looking at code samples.

Dennis

"Doug Robbins - Word MVP" wrote:

It is definitely possible using vba.

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

"MTechG" wrote in message
...
Doug

Thanks for those links I'm looking into them now. I wish I could use a
report but the template that I'm populating is for a Quoting system so
there
is a lot of text to add and each one is different.

I'm looking at the compound merge right now. What I was thinking about
was
maybe a looping scenario to populate the table on the fly. Create the
table
based on knowing how many rows and columns and insert the data using
the
loop
and offsets. I've done something like this in Excel but Word is a
different
animal.

I'm going to look at creating a table on the fly in a Word Document
knowing
how big the table needs to be.

The loop would be my next step which is probably going to be the
toughest
part of the whole thing.

Let me know what you think about this scenario if it's worth attempting
I
think it is but I don't have a lot of experience with coding with Word.

TIA



"Doug Robbins - Word MVP" wrote:

Why not use an Access Report?

Sounds like you are probably trying to perform a "multiple items per
condition (=key field)" mailmerge which Word does not really have the
ability to do:

See the "Group Multiple items for a single condition" item on fellow
MVP
Cindy Meister's website at

http://homepage.swissonline.ch/cindy...faq1.htm#DBPic


Or take a look at the following Knowledge Base Articles

http://support.microsoft.com/default...b;en-us;302665


http://support.microsoft.com/default...b;en-us;294686

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

"MTechG" wrote in message
...
Doug

I'm looking to populate the table with multiple records for a query.
I
tried mail merge and I have six records that are in the query now
and I
add
the field project in the table and the document is created six
times.
From
what I've been reading I believe it can be done in mail merge it's
just
I'm
doing something wrong.

Dennis

"Doug Robbins - Word MVP" wrote:

What do you want to populate the table with? - Data from a single
record? -
Data from Multiple Records? - Data from all of the Records? - of
just
some
of them? If the latter, what is the criteria for selecting the
ones
from
which the data is to be used?

Sorry, more questions than answers.

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

"MTechG" wrote in message
...
I've got a template document I'm setting up and would like to
populate
a
table from Access. I already populated fields inside the
template
from
Access with VBA. Using Word/Access XP

Any hints?

TIA












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
formatting numeric data from Access merged into a Word table LacieMoon Mailmerge 11 December 5th 06 10:12 PM
Word Merge with Access Data into a table jocranson Mailmerge 1 September 24th 05 05:50 AM
Table headers/footers and layout Keith Page Layout 1 April 8th 05 07:37 PM
Table AutoFormats vs. Table Styles confusion Tony Jollans Tables 5 March 6th 05 07:18 PM
why word 2000 mail merge opens multiple instances of access table. Johnny C. Mailmerge 0 February 3rd 05 05:11 PM


All times are GMT +1. The time now is 05:26 AM.

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

About Us

"It's about Microsoft Word"