Forum Discussion

fred999's avatar
fred999
Copper Contributor
Jun 21, 2022

Bug in Access 2019 SelLength on GotFocus in Textbox

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

  • Doh! Insert not Overwrite was on, on the keyboard!!!
    Not a bug then.
    Stupid programmer instead.
  • fred999's avatar
    fred999
    Copper Contributor
    Doh! Insert not Overwrite was on, on the keyboard!!!
    Not a bug then.
    Stupid programmer instead.

Resources