且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Access VBA在textBox.Setfocus之后选择TextBox中的所有文本

更新时间:2022-06-19 07:40:18

您可以使用下面显示的代码。如果不起作用,请在代码的第一行放置一个断点。如果它没有在您的断点处停止,则您的事件将无法识别。

You can use the code shown below. If it doesn't work, place a breakpoint at the first line of code. If it doesn't stop on your breakpoint, then your event is not recognized.

Option Compare Database
Option Explicit

Private Sub txt_CompraPreco_Click()
    If Len(Me.txt_CompraPreco & "") = 0 Then Exit Sub
    Me.txt_CompraPreco.SelStart = 0
    Me.txt_CompraPreco.SelLength = Len(Me.txt_CompraPreco)
End Sub