Tab using a command button

  • Thread starter Thread starter Nick T
  • Start date Start date
N

Nick T

Hi,

Is there a code which i can put into a command button's click event which
will setfocus to the next item in my tab index??

Thanks
 
How many times are you going to ask this?
No, there's no way in the sense you are asking because a tab will move the
focus from where you are standing now, not where you were, and now are ON
THE BUTTON.

But here is a hint:
Make an array of controls or named them like this "txt1, txt2, txt3..." Some
ordinal name that you could follow as tab order.
This is the code for the command button click event:
strLastCtrl = Screen.PreviousControl.Name
strName = "txt" 'put the name you choose for the array of controls
strNextCtrl = strName & Mid(strLastCtrl, Len(strName),
Len(strLastCtrl) - Len(strName))
Controls(strNextCtrl).SetFocus

May be you didn't have good results on your past threads but reposting the
same question in a new thread won't supposes any advantage.
This is the last time I try to help you.

Rastro
 
Hi

If you look back over previous post you will see some of mine (quite a while
ago) regarding a touch screen application I made for some of our staff. I
have made quite a few now.

Looking at your posts I think you are going about it slight the wrong way.
Touch screens will "act" like a keyboard - so you don't need to code the
events any different. eg. Sendkeys "{TAB}",True is not needed.

************************
The trick is to set up the "screen" not the access DB. Your forms will work
as normal as long as you take the time to set up the screen.
************************

Of course there are some times when the screen will not do what you want -
like filling in text boxes with letters or numbers. In this case you can get
round this by create a popup form will lots of Onick events. So if your main
form textbox123 has the focue your need to code the OnOpen event of the popup
form to fill in this control and if (for example) text987 has the focus then
the OnOpen of the popup fills n this this.

Something like this (on the popup)

Private Sub box1_Click()
Mainform box 1 = Me.popup box 1 & "1"
End Sub
Private Sub box2_Click()
Mainform box 2 = Me.popup box 1 & "2"
End Sub
Private Sub box3_Click()
Mainform box 3 = Me.popup box 1 & "3"
End Sub
Private Sub boxA_Click()
Mainform box A = Me.popup box 1 & "A"
End Sub
Private Sub boxb_Click()
Mainform box b = Me.popup box 1 & "b"
End Sub
'note lower case'

In some cases you need (to get a full keyboard) to use the Sendkeys
"{???}",False (do a help search for how to do this)

So just sit down and code the popup with the entire keyboard. It does take
a while (a long while) but you only need one popup and this can fill in any
text boxes or other controls on main form(s).

Following on for what Rasto told you - I think you need to look first at the
"screen" and then make the access DB. I would make the DB to work on a
normal keyboard and "then" change it to work on a touch screen (it really
does not take much alteration - "IF" you have set up the screen right in the
1st place).

Good luck with your application
 

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

Back
Top