SOLVED

Bug in Access 2019 SelLength on GotFocus in Textbox

Copper Contributor

There appears to be a bug in Access 2019 - where setting SelStart=0 and then SelLength=0 in a GotFocus event in a Textbox causes the first character in the textbox to be selected. One would expect the cursor to be set to the beginning of the text in the Textbox with NO selection (instead of one char selected).

 

Tested on a completely New database with just two textboxes on a Form.

 

Private Sub Form_Load()
    txtTest1 = "Some text"
    txtTest2 = "Other text"
End Sub

Private Sub txtTest1_GotFocus()
    txtTest1.SelStart = 0
    txtTest1.SelLength = 0
End Sub

 

Microsoft® Access® 2019 MSO (Version 2205 Build 16.0.15225.20028) 32-bit

1 Reply
best response confirmed by fred999 (Copper Contributor)
Solution
Doh! Insert not Overwrite was on, on the keyboard!!!
Not a bug then.
Stupid programmer instead.
1 best response

Accepted Solutions
best response confirmed by fred999 (Copper Contributor)
Solution
Doh! Insert not Overwrite was on, on the keyboard!!!
Not a bug then.
Stupid programmer instead.

View solution in original post