set focus highlites whole textbox

  • Thread starter Thread starter seeker
  • Start date Start date
S

seeker

I run the following code but want just the cursor to show at the extreme left
inside the text box instead of the whole textbox being hilited.

Dim intitem As Integer
intitem = DET_ITEMNBR1
DET_ITEMDESC1.SetFocus
DET_ITEMDESC1.Text = DLookup("[ite:desc]", "item", "[ite:number] = '" &
intitem & "'")
DET_PRICE1.SetFocus
DET_PRICE1.Text = DLookup("[ite:price]", "item", "[ite:number] = '" &
intitem & "'")
DET_ITEMDESC1.SetFocus


Thanks in advance.
 
Use the SelLength and SelStart properties.

Dim intitem As Integer
intitem = DET_ITEMNBR1
DET_ITEMDESC1.SetFocus
DET_ITEMDESC1.Text = DLookup("[ite:desc]", "item", "[ite:number] = '" &
intitem & "'")
DET_PRICE1.SetFocus
DET_PRICE1.Text = DLookup("[ite:price]", "item", "[ite:number] = '" &
intitem & "'")
DET_ITEMDESC1.SetFocus
DET_ITEMDESC1.SelStart = 0
DET_ITEMDESC1.SelLength = 0
 
Thanks that did the trick.

Ken Snell said:
Use the SelLength and SelStart properties.

Dim intitem As Integer
intitem = DET_ITEMNBR1
DET_ITEMDESC1.SetFocus
DET_ITEMDESC1.Text = DLookup("[ite:desc]", "item", "[ite:number] = '" &
intitem & "'")
DET_PRICE1.SetFocus
DET_PRICE1.Text = DLookup("[ite:price]", "item", "[ite:number] = '" &
intitem & "'")
DET_ITEMDESC1.SetFocus
DET_ITEMDESC1.SelStart = 0
DET_ITEMDESC1.SelLength = 0

--
Ken Snell
http://www.accessmvp.com/KDSnell/




seeker said:
I run the following code but want just the cursor to show at the extreme
left
inside the text box instead of the whole textbox being hilited.

Dim intitem As Integer
intitem = DET_ITEMNBR1
DET_ITEMDESC1.SetFocus
DET_ITEMDESC1.Text = DLookup("[ite:desc]", "item", "[ite:number] = '" &
intitem & "'")
DET_PRICE1.SetFocus
DET_PRICE1.Text = DLookup("[ite:price]", "item", "[ite:number] = '" &
intitem & "'")
DET_ITEMDESC1.SetFocus


Thanks in advance.
 
Back
Top