PDA

View Full Version : Add Table through Code



catalanfreak
07-11-2005, 06:00 AM
Hello all,

I'm wondering if anybody here can help me with the problem I have:
I want to "simulate" the Add New Entry button from Access in Word. That is:
I have a Word doc with several formfields in a table for the user to fill with data for Performance Objectives. So the table would be the first row of data in MS Access.
But the number of Objectives per user can be very different (from 1 to 15). I don't find elegant to have 15 empty tables with exactly the same format and number of fields, so I would like the user to be able to add (and maybe remove) objectives to the document just by clicking in a button. Then, a another empty objective would be added to the document and the user would fill it.
How can I approach this? I have experiencie in VBA coding, so any single code example would be very appreciated.
Thanks in advance!

Jordi

P.S.: I really need to take in account the name of each field, because then I import the data into Access. For instance, the name of the first field for the first objective would be "Description1", but the name of the first field for the second objective would be "Description2".

MOS MASTER
07-11-2005, 08:56 AM
Hi & Welcome to VBAX Jordi, :hi:

Take a look at this thread:
http://www.vbaexpress.com/forum/showthread.php?t=3387

My example inserts a new row with fields automaticaly and Gerry's example has a little different approach.

But from looking at these examples I'm sure you can get a good head start on your queste.

HTH, :whistle: