Entering data and updating forms www datinglincs co uk
The technique requires an Access database, a Word form, and a bit of Visual Basic for Applications (VBA) code. Clear End If Set doc = Nothing Set cnn = Nothing Exit Sub Err Handler: Msg Box Err. Description, _ vb OKOnly, "Error" On Error Go To 0 On Error Resume Next cnn.(Instructions for Word 20 are given, but the technique will work in versions 2000, XP, and 2002.) For the sake of simplicity, the example Word form transfers data to Northwind, the sample database that comes with Access. Close Set doc = Nothing Set cnn = Nothing End Sub Return to the Word form and double-click txt Phone.To add the function, do the following: Sub Transfer Shipper() 'Transfer new shipping company record to 'Shippers table in Northwind database. Connection Dim str Connection As String Dim str SQL As String Dim str Path As String Dim doc As Word. For instance, you might want to check for an empty field or an inappropriate data type.Document Dim str Company Name As String Dim str Phone As String Dim byt Continue As Byte Dim lng Success As Long Set doc = This Document On Error Go To Err Handler str Company Name = Chr(39) & doc. When you click Yes, the code builds a SQL INSERT INTO statement that includes the Access fields and the input values in the form: You don't have to include an input value for every field in the Access table, although you must include an input value for every required field.Be sure the order of the Access and Word input fields match.
(The txt tag identifies the field as a text field.) Once you have a form to fill out, you need the VBA function that transfers input values to an Access database. str Path = "C: Program Files Microsoft Office11Office11Samples Northwind.mdb" str Connection = "Provider=Microsoft. After entering a phone number, press Tab to exit the field, which triggers the function returns a single quote character ('). This is also the spot to check the user's input values for valid data.
When applying this technique to your own work, you will need to know the following details before you create the Word form: is a predefined cell that stores and accepts data input. In the resulting Options dialog box, choose Transfer Shipper from the Exit option's dropdown list, as shown in Figure D.
The example Word form in Figure A contains two text fields. That way, exiting the last field in the form triggers the code that transfers the input values to Access.
Once you are happy with your list, you can then easily export and apply it As you can see, the list easily exports into an Excel version of itself, which you can then use for whatever analysis or data presentation you so choose.
The images I included in my list ended up reverting to the alternate text, but numbers, text, and multiple choices export in a format that can be easily sorted, filtered, and analyzed.
Note: The following screenshots were taken from my Demo Site (previously featured in the "What Are Share Point Templates and How Do You Use Them?