This issue may occur if you wish to customize a mailing label or envelope template and ensure that the City field closes up blank space so that the State abbreviation will always be the correct distance from the City name.
While the example in this document uses the City field, you can replicate this procedure to close up the blank space on any ACT! fields on a label, envelope or report template.
Follow the steps below:
- Click the Reports menu, and then click New Template. The Report Designer launches and the New Report dialog box appears:
Note: Images in your version of ACT! may differ slightly from the ones used in this Answer.
- Ensure that the correct option is selected in the Report Types section. For our example, we will enable Contact Reports, click Contact Labels and then click OK. The Create Label dialog box appears:
- Click the Select a Product drop down arrow and find the correct label size or adjust your label dimensions manually, and then click OK. The label template appears:
- Click the File menu, and then click Save As to save your new label template with a unique name.
- Begin by placing the fields on the detail portion of the blank label template using the field tool: (as illustrated below)
- Once all fields are in place, we can configure the City field to print with blank space collapsed.
- You must view the Properties Window to proceed. If the Properties are not visible, press F4 or click the View menu, and then click Properties Window. The Properties window appears on the right side of the Report Designer:
- Click the C:City field, and then change the Visible property to False. (the field will display a crosshatched background)
- Examine the Name property. If a space exists between the word City and the associated number, click into this value and delete the space. The value for this name property must display as City1.
- Repeat steps 8 and 9 for the C:State and C:ZIPCode fields in this same line on your label template.
Hint: Take note of the Name values as you will need this information later in the procedure.
The next step is to clear a space for a Custom field that will close up the blank space in any fields you wish to include.
- Click the C:City field to select it. Sizing handles appear to surround the field. Place your cursor over the top, center sizing handle and drag down to reduce the height of the field to a minimal value --or-- from the Properties window, under the Layout section locate the Height item and change the value to 0.01. When the field is selected, you may also use your keyboard arrow keys to move the field down slightly (if necessary).
- Repeat step 11 for the C:State andC:ZIPCode fields so that you have an empty space in the appropriate location to insert another field (as illustrated above).
Note: When using a custom field, the fields that compose the custom field must be placed physically above the custom field or it will not pull data correctly.
- Click the System Field tool in the Toolbox, and then drag a new field into the space created in steps 11 and 12. The Select System Field dialog box appears:
- Clear the Include a label option, click Custom from the Available Fields list, and then click Add.
- Click Close to exit the Select System Field dialog box. The Custom field appears on your label template. (as illustrated below)
- Click the Custom field to select it.
You have two options for creating the expression for this Custom field. It is NOT recommended to use both methods in the same template.
Note: If your expression will contain commas, then use Method 1 listed below, not Method 2.
- Right-click in an empty part of the template near the Custom field, and then click Edit Report Scripts. The Edit Section Scripts dialog box appears:
- This dialog box can be used to program instructions for Custom fields. An Edit Section Scripts dialog box exists for each section that includes Custom fields. You will need to write a small (Visual Basic) script in this dialog box to instruct the report for the included Custom field. Be sure to include the exact punctuation, spacing and capitalization you see below:
- In our example, you would enter in the above text in the Edit Section Scripts dialog box. This statement will instruct the report when it reaches the City1 field to use data from the City1, State1, and ZIPCode1 fields to fill in the Custom1 field.
Note: This 'If' statement' contains two conditions. When the first statement is false, the second statement will be executed. When the first condition is true, the action in that part of the statement will be executed.
In our example, the If statement is checking the to see if there is a value (data) in the City1 field. The first condition reads:
If City1 = NULL THEN
Custom1.Text = City1&" "&State1&" "&ZIPCode1
Custom1.Text = City1&", "&State1&" "&ZIPCode1
This tells the report; if there is no data in the City1 field, to use the data from the City1, State1, and ZIPCode1 fields for the Custom1 field. The ampersand (&) defines the end of the field. Quote marks, separated by a space (" ") instruct the report to place a space between the fields of data.
The statement continues if the first condition is false. The Else in this script, instructs the report that if there is data in the City1 field to use the data from the City1, State1, and ZIPCode1 fields for the Custom1 field.
The End IF closes the 'If statement' and if not included, this function could cause an infinite loop in this statement that would appear to freeze the report.
- Click OK to close this dialog box and return to the Report Designer.
- Press F4 on your keyboard to bring up the Properties window on the right.
- From the dropdown windows at the top of Properties window, scroll down and select "Custom 1 Custom"
- In the Misc section of the Properties window, rename the Custom1 value to a name of your choice. Be sure that you do not include a space in this name.
- Locate the Expression property. Click in the blank space on the value (right) column for this property, and then type the name of the first field (as noted in steps 9 and 10) followed by an ampersand (&), a (double) quote mark, a space, another quote mark, another ampersand, the next field name, etc. (as illustrated below)
- When you are finished, the label template reflect the Expression of these values in the custom field. (as illustrated below)
- With the custom field on your label template selected, note that you can place a comma or any valid character (or string of characters) between the quote marks as constants to be printed on each label.
- When complete, click the File menu (in the Report Designer), and then click Print Preview. If your labels (envelopes or report) do not display the data correctly, double check the spelling and placement of the text in the value for the Expression property of your Custom field.