A string field allows you to enter and view up to 255 text characters.
All VBA field events function for a focusable string field.
VBA uses a string value when referencing string fields. If you set the value of a string field that uses a format (such as a phone number field), include all formatting characters, including parentheses, static text, dashes and spaces. When you return the value of a formatted string value, VBA returns the formatted string value.
The following example sets the value of the Batch ID string field when the user chooses a document type from the Document Type drop-down list in the Receivables Transaction Entry window:
Private Sub DocumentType_AfterUserChanged() Select Case DocumentType 'Move the focus to the Batch ID field and set the value Case 1 BatchID.Focus("DAILYSLS") Case 7 BatchID.Focus("DAILYRET") Case Else BatchID.Focus("DAILYMISC") End Select End Sub
In the following example, the procedure sets the value of the Phone 1 field using a formatted string:
Private Sub CustomerID_Changed() If CustomerID = "AARONFIT0001" Then Phone1 = "(701) 555-7890 Ext. 1234" End If End Sub