-
Hi I have been struggling with this for a few weeks now all suggestions do not seem to work. I am writing a program which validates well on the return key but as many users especially experienced one like to use tab and therefore go though my program with no validation, i want to validate on tab too or disable it. I have tried the keyascii for tab which is 9 but this does not seem to work. I have tried validation on a lost focus but just got into a messagebox hell with everytime you left a box with nothing in it threw up a messagebox good butwhen you tried to set the focus back to the original text box you got another lostfocus empty box messagebox from the one it had just left. I have tried vbtab but thast did noty seem to work and tried chr(9) with no success. Please oh people with brains and exquisit knowledge help me out here
nuts
-
Unfortunately here is how the Tab key works. If there is only one control on a form with TabStop = True, the Tab key will be recognized and you can check for it, but if there is more than one you can't check for it. What you need to do is this:
1) In the form's Load event, store the TabStop values for all the controls that you are interested in
2) Then in the GotFocus even of each control set the TabStop property of all other controls to False (you could write a subroutine to do this)
3) And then in the LostFocus event set the TabStop values of all the controls back to their originally stored values.
-
many thanks MartinLiss i will do that
nuts
breathing easier again