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

txtBox.SetFocus has Wigged Out!

Status
Not open for further replies.

Rougy

Programmer
Oct 15, 2001
249
US
Any ideas?

If txtBox1 = "" Then txtBox1.SetFocus: Exit Sub
If txtBox2 = "" Then txtBox2.SetFocus: Exit Sub
If txtBox3 = "" Then txtBox3.SetFocus: Exit Sub

For some reason, when I use this logic, the program ignores the first line and sets the focus to txtBox2.

But when I walk through the code, it sets it to txtBox1.

There is no code executing after this set of commands.

I'm absolutely baffled.

Rougy


-----
The death of dogma is the birth of reason.
 
Is it ?

if not textbox1.text = "" then
Msgbox "Full"
if not textbox2.text = "" then
Msgbox "Full"
if not textbox3.text = "" then
Msgbox "Full"
else
textbox3.setfocus
end if
else
textbox2.setfocus
end if
else
textbox1.setfocus
end if
 
Yes, I'm absolutely sure txtBox1 is empty.

Would it have anything to do with the _KeyDown event that I'm calling the code from?

-----
The death of dogma is the birth of reason.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top