Date

Description

A date field displays a date, in a format specified by your operating system settings for date and time.

Events

All VBA field events function for a focusable date field.

VBA usage

VBA uses a formatted string value when referencing a date field. When you set a date value, the text value must match the operating system settings for date and time, such as “12/31/96” (using MM/DD/YY format) or
“31-12-96” (using DD-MM-YY format).

Examples

In the following example, VBA code sets the value of a date field to a fixed string value:

Private Sub Window_BeforeOpen(OpenVisible As Boolean)
	PostingDate = "07/28/97"
End Sub

In the following example, VBA code combines a string with a date field to construct a new batch ID in the Invoice Entry window:

Private Sub DocumentType_AfterGotFocus()
	If DocumentType = 2 Then
		'The user selected returns
		'Place the focus in the Batch ID field and set the value
		BatchID.Focus("RET-" + Str(UserInfoGet.UserDate))
		'Constructs "RET-07/28/97" as the batch ID
	End If
End Sub


Documentation Feedback