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

set Focus back to current text box

Status
Not open for further replies.

kronar

Programmer
Jan 12, 2003
60
US
I can't seem to find how to reset the tab order or focus back to the same text box after I detect entry in error. I am seting textbox value to null and then want the cursor to be set back to that text box after user clicks OK on the msgbox warning record not found.
I am sure I used to be able to do this, but can't find any example or description in any of my books or help files.
I find VB with Access97 so frustrating trying to find any information - is this really so hard??
 
How are ya kronar . . .

Use the [blue]Before Update[/blue] event of the control and set the [blue]Cancel[/blue] to true if your validation fails . . .
Code:
[blue]   If Trim(Me!TextboxName & "") = "" then
      [purple][b]Cancel[/b][/purple] = True
   End If[/blue]
[blue]Focus stays in the control! . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top