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

LostFocus/Setfocus Problem

Status
Not open for further replies.

davetek

Programmer
Oct 30, 2002
42
IE
hey,

i have a form with multiple text boxes and combo boxes.
one of the conditions is that when you enter data in combo box A, text field B is automatically filled in.
i have this working by using the LostFocus function on the combo box event. this works fine.
the problem i have is when i error check.
i have to set the focus on each field to check if all data has been entered.
therefore the combo box and text field will receive and lose the focus, which cause the LostFocus event to execute again.
also i dont want to use the click event, cause the user wants to tab through the form.
if anyone can understand my problem and has a suggestion, that would be great.

cheers
 
if you're using vb, you can do the following

if me.yourcontrolname <> &quot;whatever it should&quot; then
'do whatever you want
end if

you'll have to do this with each control (this would be on the on close event - or where evern you want it, on the move next or whatever)

Randall Vollen
National City Bank Corp.

Just because you have an answer - doesn't mean it's the best answer.
 
Hi davetek

How about using the combo's AfterUpdate event rather than LostFocus? This only fires when the combo's value is updated so you can tab on and off the field as much as you want without any code being kicked off.

Hope this helps ...

Mac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top