![create form fields in word 2007 create form fields in word 2007](https://i.ytimg.com/vi/bdGtJb6Cqrg/mqdefault.jpg)
- Create form fields in word 2007 how to#
- Create form fields in word 2007 pdf#
- Create form fields in word 2007 code#
- Create form fields in word 2007 download#
The form’s Close event clears all three fields before closing without saving your choices. FillDependentFields() uses the selected value in wfLastName to fill in wfTitleOfCourtesy and wfFirstName. Next, enter the sub procedures in Listing B and Listing C to the form’s module. Figure B Add the DAO library to the project. Don’t skip this step or the form won’t work. x Object Library, as shown in Figure B, and clicking OK. Add DAO to the project by choosing References from the Tools menu and then checking Microsoft DAO 3. This sub procedure uses the Data Access Objects (DAO) library, which is no longer Office’s default library, but this is one of those times when DAO is more efficient that ActiveX Data Objects (ADO).
![create form fields in word 2007 create form fields in word 2007](https://img.yumpu.com/7747533/1/500x640/creating-a-fillable-form-in-word-2007.jpg)
With doc.FormFields("wfLastName").DropDown.ListEntries StrSQL = "SELECT LastName FROM Employees ORDER BY LastName"
Create form fields in word 2007 code#
To complete the job, the code cycles through the recordset to copy the retrieved names to wfLastName. This procedure creates a connection to Northwind, uses SQL to create a Recordset object, and then fills that recordset with last names from the Employees table. Enter the sub procedure (macro) in Listing A. In the Project Explorer, double-click ThisDocument for the current project to launch the form’s module (if necessary). To populate the dropdown field, open the Visual Basic Editor (VBE) by pressing Alt+F11. Fortunately, there are only nine employees, so Word’s native field is adequate. There’s one limitation - the dropdown field can display only 25 items. Retrieve only the values you need when applying this to your own work. To keep things simple, the example form pulls over only a few values. You don’t have to give the Word fields similar names, but doing so simplifies your work because the names are self-documenting. These names correspond to field names in the Employees table (in Access). Name them as shown in Table A by double-clicking each to open its options dialog. Complete this process three times to add two text box fields and one dropdown field to the form. To add a field, position the cursor and then click the appropriate tool on the Forms toolbar. Display the Forms toolbar by right-clicking any toolbar and checking Forms. To create the form, start with a blank document.
![create form fields in word 2007 create form fields in word 2007](https://www.addictivetips.com/app/uploads/2010/05/developer.jpg)
Figure A Use the dropdown field to dynamically fill other fields. Specifically, the form retrieves data from the Employees table in the Northwind database (the sample database that comes with Access). The example form in Figure A lets you choose a last name from the dropdown field and then automatically fills in the remaining text box fields with corresponding data from an Access table. A field is a predefined cell for entering and storing information. A form is a Word document that contains fill-in blanks or fields, in which you enter information. To dynamically fill in Word fields from an Access table based on the contents of another Word field, you’ll need a Word form, an Access table with data, and some Visual Basic for Applications (VBA) code.
Create form fields in word 2007 how to#
This blog post was inspired by a message from TechRepublic member who asked: “Hello! I am desperately trying to figure out how to select a choice in a field in the beginning of my form and pre-fill the default values for other fields in the form based on that first dropdown choice.” Building the Word form Then, the same form uses the selected value from that field to retrieve more Access data. The example technique in this TechRepublic How do I… populates a Word 2003 dropdown field with Access data. That takes a bit more work than a simple mail merge, but it’s certainly doable. Perhaps you want to filter Access data based on the contents of a Word field. For instance, you might use Word’s mail merge feature to complete invoices in a Word form using customer data from an Access database. Fortunately, Office applications share data easily. Word lets you create and edit documents and Excel analyzes your data.
Create form fields in word 2007 download#
The download includes a sample Access database and Word form.Įach Microsoft Office application specializes in a specific job.
Create form fields in word 2007 pdf#
This blog post is also available in PDF form as a TechRepublic download. Each Microsoft Office application specializes in a specific job. The download includes a sample Access database and Word form. How do I… Dynamically fill Microsoft Word fields using Access data?