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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab Index Problem

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I have setup my forms so the cursor will move where I want it to using tabindex...everything works fine when theres no data on the form. as soon as the user saves the data, then if someone goes back to edit a record, the tabindex will not work correctly. what would cause me to loose the tabindex?? or is there something im missing?

Thanks in advance
 
When my form loads I added the SetFocus to the correct combobox where the TabIndex = 0.. But theres still a problem. In my error handler I Resume next to by pass the error, the form opens and then the tabing is correct throughout the form. when debugging my error, the message is as follows:

"Runtime Error 5"

Invalid Procedure Call or Argument.

It then highlights myField.SetFocus..

Why?? is that because the field i am trying to set focus to is already set at TabIndex = 0 ???

 

If the form (or control) is not visible then you will get this error. Make the "Control.SetFocus" the last thing you have in form load and right before it put a "Me.Show".

Good Luck
 
If myField visible and enabled. You will get that error if you try to set focus to a disabled or invisible control.
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Yaa...thats what I did..I changed it so instead of SetFocus it is FieldName.TabIndex = 0

That seemed to work.. Just wondering why I was getting that Error...
 
Another question related to Tabbing:

I have set the Enter key to act like the tab key..

When the user tabs, how could I set it so it selects or Highlights the entire text?? so if the user wants to change or edit that field it will go right over the existiong text??

Thanks
 
Check out the SelStart and SelLength properties of the control which you can set in the GotFocus event for that control Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 

[tt]
Private Sub Text1_GotFocus()

On Error GoTo Text1_GotFocusError

Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)

Exit Sub
Text1_GotFocusError:

MsgBox Err.Description

End Sub

[/tt]
 
Thanks for that...got it..but another problem..since i have in the keypress event of the text box,

If KeyAscii = 13 Then KeyAscii = ""
SendKeys Chr$(9)

it jumps to the next textbox...

how can i combine the two??
 
If KeyAscii = 13 Then
KeyAscii = ""
SendKeys Chr$(9)
End If Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top