Select Entire Field - VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I select an entire field with VBA?

My user clicks on the field (not tab field), gets a warning, and focus is
set back to the field -- but the cursor does not select the entire field.
This is a decimal entry/percent and would be easier for user to just type
entry and not have to select the field or make adjustments.

Using Access 07 and database option is set to Select Entire Field.

Very much an amateur in need of aid...
thanking you in advance,
Greg
 
Hi Chris,

You can do this on a form, but not as far as I know on a table or query
datasheet. You need something like this (air code alert!) in the control's
Enter event procedure:

Me.XXX.SelStart = 0
Me.XXX.SelLen = Len(Me.XXX.Text)

Replace XXX with the name of the control.
 
Actually Greg, but Chris is here, too! Thanks for responding and the
suggestion.

Here's my code...
Me.txtDiscount.SetFocus
Me.txtDiscount.SelStart = 0
Me.txtDiscount.SelLen = Len(Me.txtDiscount.Text)

Compile error: Method or data member not found.
It has highlighted "SelLen".

What does it?
 
Thanks for the help John.

I have discovered I do not have to enter as decimal and that solves my issue.
 
Back
Top