Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

number field has zero showing in text box used ot highlight 1

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
Field is a single number type, I have a subform and as you tabbed to a number field it would highlight the zero so you could type over it as you typed in your number. Now that does not work. When you tab into the field the cursor is setting to the left of the zero and then does not go away you have to delete it. Pain!

DougP
[r2d2] < I Built one
 
OK I found it. I changed the "Behavior entering field", in Tool menu Options , Keyboard tab. from "Select entire field" to "Go to start of field"
I did that for some other reason, which changed this as well. So I put it back.


DougP
[r2d2] < I Built one
 

If you'd like to have your cake and eat it too, you can! You can leave Behavior entering field in Tool menu at Go to start of field and then selectively change the behavior for the textbox in question, using these bits of code. Just replace YourTextBoxName with the name of your actual textbox:

Code:
Private Sub YourTextBoxName_Click()
If Not IsNull(Me.YourTextBoxName) Then
  YourTextBoxName.SelStart = 0
  YourTextBoxName.SelLength = Len(Me.YourTextBoxName)
End If
End Sub

Code:
Private Sub YourTextBoxName_GotFocus()
If Not IsNull(Me.YourTextBoxName) Then
  YourTextBoxName.SelStart = 0
  YourTextBoxName.SelLength = Len(Me.YourTextBoxName)
End If
End Sub

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Sorry, the End Sub in the second bit of code didn't get included with the code; just be sure to add it.

BTW, the only thing I dislike about this forum is the inability to edit one's own posts!

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 

Also meant to add that you don't have to have the zero displated, you know, unless you want it to. You can go into the Design View for the table and delete the zero from the Default Value box.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
missinglinq, That is very good to know.

"delete the zero from the Default Value box."
Did not know you could do that.
Thanks

DougP
[r2d2] < I Built one
 

"It's better to know then not to know!"

-Robert Parker, author of "Spenser for Hire"

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top