The following code always works if I set a break point, and traces through as I would expect it to.
It never works the first, and only the first, time I click on the "BudgetYear" control IF the record is a new record.
Anybody seen this? Am I missing something?
The budget year is a four digit year that may have a letter at the end to indicate "Proposed" (Input mask is: 0000?;;
Desired behavior is to move to the start of the field if a new record. If it's not a new record, then select the character the user clicked on. (Usually the last, or next to the last, character.)
It never works the first, and only the first, time I click on the "BudgetYear" control IF the record is a new record.
Anybody seen this? Am I missing something?
Code:
Private Sub BudgetYear_GotFocus()
If Me.NewRecord Then
Me.BudgetYear.SelStart = 0
Me.BudgetYear.SelLength = 0
ElseIf Nz(Me.BudgetYear, vbNullString) = vbNullString Then
Me.BudgetYear.SelStart = 0
Else
Me.BudgetYear.SelLength = 1
End If
End Sub
Desired behavior is to move to the start of the field if a new record. If it's not a new record, then select the character the user clicked on. (Usually the last, or next to the last, character.)