PC Review


Reply
Thread Tools Rate Thread

complex table manipulation via VBA (in ms access)

 
 
Keith G Hicks
Guest
Posts: n/a
 
      20th Sep 2007
I am trying to populate a table (word 2003) via automation in ms access.

My template word file is set up with a table as follows (sorry, I cannot get
all this to not wrap funny so my samples may not be as clean looking as I'd
like):
---------------------------------------------------------------------
| Customer / | Address | Values |
Phone/ |
| Cust # | |
| Fax |
---------------------------------------------------------------------
| FormField | | Bldg: FormField |
|
| | FormField | Autos: FormField |
FormField|
-------------| | Land: FormField |
FormField|
| FormField | | Mach.: FormField |
|
| | |
| |
---------------------------------------------------------------------

At the moment I have non bookmark bound form fields indicated above by
"FormField"

I need to end up with something similar to what's shown below. The number of
"rows" of course depends on how many customer records there are.

----------------------------------------------------------------------------
--------------
| Customer / | Address | Values
| Phone/ |
| Cust # | |
| Fax |
----------------------------------------------------------------------------
--------------
| George | | Building:
$500,000 | 213-6541 |
| | 123 Main | Autos: $
78,000 | |
----------------| Suite 1 | Land: $125,000
| 213-6544 |
| 12 | Elmville, MO 50121 | Machines: $750,000
| |
| | |
| |
----------------------------------------------------------------------------
--------------
| Harry | | Building:
$450,000 | 477-7500 |
| | 75 Elm | Autos:
$241,000 | |
----------------| Berkley, CA 91323 | Land: $ 90,000
| none |
| 15 | | Machines:
$621,000 | |
| | |
| |
----------------------------------------------------------------------------
--------------

So I not only need to get the correct data into each form field but I also
need to "append" a new properly laid out set of rows to the table for the
next record(s). I have no way of knowing in advance how many records there
will be and I cannot have blank rows.

Can anyone suggest a good way to handle this? In the past, I've done this
without tables and just set up tab positions. I'd place a single bookmark at
the start of the data and then tab to each column (but no table remember)
and then do a CR at the end of the line. This has always worked fine but my
client wants a fancier layout than that.

In addition, they want this to be a "form" (which is why I need the form
fields) so that end users can only edit the data in the form fields. I know
I need to programatically turn off protection when creating the doc in code
but then I turn it back on once the doc has been created.
Thanks in advance,

Keith




 
Reply With Quote
 
 
 
 
Keith G Hicks
Guest
Posts: n/a
 
      20th Sep 2007
I just realized this ought to be asked in the word.vba.general newsgroup so
I'm moving it there instead.

Keith

"Keith G Hicks" <(E-Mail Removed)> wrote in message
news:uKxDdb5#(E-Mail Removed)...
> I am trying to populate a table (word 2003) via automation in ms access.
>
> My template word file is set up with a table as follows (sorry, I cannot

get
> all this to not wrap funny so my samples may not be as clean looking as

I'd
> like):
> ---------------------------------------------------------------------
> | Customer / | Address | Values |
> Phone/ |
> | Cust # | |
> | Fax |
> ---------------------------------------------------------------------
> | FormField | | Bldg: FormField |
> |
> | | FormField | Autos: FormField |
> FormField|
> -------------| | Land: FormField |
> FormField|
> | FormField | | Mach.: FormField |
> |
> | | |
> | |
> ---------------------------------------------------------------------
>
> At the moment I have non bookmark bound form fields indicated above by
> "FormField"
>
> I need to end up with something similar to what's shown below. The number

of
> "rows" of course depends on how many customer records there are.
>
> --------------------------------------------------------------------------

--
> --------------
> | Customer / | Address | Values
> | Phone/ |
> | Cust # | |
> | Fax |
> --------------------------------------------------------------------------

--
> --------------
> | George | | Building:
> $500,000 | 213-6541 |
> | | 123 Main | Autos: $
> 78,000 | |
> ----------------| Suite 1 | Land:

$125,000
> | 213-6544 |
> | 12 | Elmville, MO 50121 | Machines: $750,000
> | |
> | | |
> | |
> --------------------------------------------------------------------------

--
> --------------
> | Harry | | Building:
> $450,000 | 477-7500 |
> | | 75 Elm | Autos:
> $241,000 | |
> ----------------| Berkley, CA 91323 | Land: $ 90,000
> | none |
> | 15 | | Machines:
> $621,000 | |
> | | |
> | |
> --------------------------------------------------------------------------

--
> --------------
>
> So I not only need to get the correct data into each form field but I also
> need to "append" a new properly laid out set of rows to the table for the
> next record(s). I have no way of knowing in advance how many records there
> will be and I cannot have blank rows.
>
> Can anyone suggest a good way to handle this? In the past, I've done this
> without tables and just set up tab positions. I'd place a single bookmark

at
> the start of the data and then tab to each column (but no table remember)
> and then do a CR at the end of the line. This has always worked fine but

my
> client wants a fancier layout than that.
>
> In addition, they want this to be a "form" (which is why I need the form
> fields) so that end users can only edit the data in the form fields. I

know
> I need to programatically turn off protection when creating the doc in

code
> but then I turn it back on once the doc has been created.
> Thanks in advance,
>
> Keith
>
>
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Append table from Complex SQL in Access 2000 vman92 Microsoft Access 6 28th Sep 2006 07:47 PM
Complex calculation and manipulation in Excel =?Utf-8?B?RGVkcmVu?= Microsoft Excel New Users 1 13th Jan 2006 10:05 PM
table manipulation taccea Microsoft Access 1 14th Jul 2004 08:24 PM
table manipulation taccea Microsoft Access Queries 0 14th Jul 2004 02:29 PM
Importing complex text file into access table Alexus Microsoft Access External Data 1 16th Nov 2003 08:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:18 PM.