Select Entire Field - VBA

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
 
G

Guest

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.
 
G

Guest

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?
 
G

Guest

Thanks for the help John.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top