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!

Quit Do...Loop Until when form loses focus?

Status
Not open for further replies.

PSchubert

Technical User
Jun 6, 2006
57
AU
Is there a way to exit a Do...Loop Until when the form containing it loses the focus? I've been trying for hours to figure out how to code this in the loop structure, but I'm really not even close. As a relative newbie, I guess this shouldn't surprise me. If anyone with greater knowledge could help short-cut my ineptitude, I would really appreciate it!
Thanks in advance.
 
Here's the solution at which I arrived (admittedly with help)! Perhaps someone else might benefit from it.

'########## Code start ##########

Option Compare Database
Option Explicit
Dim X As Boolean

Sub Form_Deactivate()
X = False
End Sub

Sub SomeProcedure()
X = True
Do While X
DoEvents
'...Code Here...
Loop
End Sub

'########## Code end ##########
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top