Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dynamically Adding controls to word VBA form

Posted on 2008-10-17
4
Medium Priority
?
999 Views
Last Modified: 2013-12-26
Hi Experts!

I am extremely new to Word VBA and not even sure of all the functions and functionality that it can provide. I am able to complete the part that involves static fields and looking for help with dynamic fields. Below is the requirement I'm stuck with.

1. I have a word form with control toolbox fields in it. I have a requirement where I need to insert controls dynamically in the form when it is opened. I need to add text box and cotrol box one at a time when a add button is clicked and remove one at a time when a delete button is clicked. This is because, there are some values that the user will enter in the form that depends on each user and cannot be static and predefined in the form. And this needs to be added in a specific area o the form (not to the end - has to be added somewhere in the middle or a specific place in the form). - this is to replicate the add row feature of repeating tables in infopath (if this info helps!)

2.once the controls are added and filled with info, Submit to Database is clicked and the information entered in the form needs to be submitted to my database (access for now).  These dynamic fields are submitted to a special (different ) database and the report id is the number with which we can identify the rows.

3. When I click Retrieve button, the info from the database based on that report id needs to be retrieved for these fields from the db and I need to populate the info back to the form in these dynamic fields on the form.

This is my first post here and i have heard a lot about your expert help! Thanks in Advance.
0
Comment
Question by:vdhavala
  • 2
4 Comments
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 22751696
see this link for an excellent tutorial on the subject:
                       http://pubs.logicalexpressions.com/pub0009/LPMArticle.asp?ID=259
0
 
LVL 15

Expert Comment

by:cquinn
ID: 22757116
Why not have the controls on the form all of the time, but hidden?  You can then unhide them when required
0
 

Author Comment

by:vdhavala
ID: 22757122
Thanks. But with this, I am able to add controls to a form on the document. I am not able to add them directly on the document. It doesn't give me the option. Any ideas ?
0
 

Accepted Solution

by:
vdhavala earned 0 total points
ID: 22797207
Well..there is no proper way to add the controls directly I guess. I have added the controls I require on a User Form and then transferred them back to main document.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question