Why is my .setfocus ignored?

前端 未结 6 2095
一生所求
一生所求 2020-12-06 11:46

I have an Access form with a textbox that is meant to allow for repeatedly typing a number, hitting enter, and letting a script do stuff. For speed, the field should keep t

6条回答
  •  执笔经年
    2020-12-06 12:48

    Try removing the whole line for variable_name.SetFocus and simply add: Cancel = True

    Private Sub MyFld_KeyDown(KeyCode As Integer, Shift As Integer)  
         If KeyCode = vbKeyReturn Then  
             DoStuff  
             Cancel = True  
         End If
    End Sub
    

提交回复
热议问题