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!

What is the Syntax for IF FORM X IS OPEN DO THIS 2

Status
Not open for further replies.

KUZZ

Technical User
Aug 13, 2002
254
GB
Hi,

I have the following statement form my form TIME3_ONTIMER
timer set at 750 (I have blinking fields, that need such small value for timer).

If Forms!Time3.ActiveControl.NAME <> &quot;text9&quot; And Forms!Time3.ActiveControl.NAME <> &quot;SPECNOTE&quot; Then
Forms!Time3.Text9.SetFocus
End If

This form also has a trigger _ONTIMER to closes after 5 minutes of inactivity. Now!, right before the form closes somewhere inbetween of open and closed the code on timer still checks for the activecontrol names which are already not available. and it gives out an error that the controls are not to be found. So I thought that by first checking if the form is open or not and then runt the above written code I would not get the error. But! I do not know what the syntax for IF FORM X IS OPEN is. Could someone please help me with that or may be give a different solution for my problem.

Thanx

Good luck,
Kuzz

&quot;Time spent debating the impossible subtracts from the time during which you
can try to accomplish it.&quot;
 
You can use this function to find out if the form is open:
Function IsItOpen(strFormName As String) As Boolean
Dim frm As Form

For Each frm In Forms
If frm.Name = strFormName Then
IsItOpen = True
End If
Next frm

End Function

Then, in your code, just do this:
if isitopen(&quot;Time3&quot;) then

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
thank you very much

Good luck,
Kuzz

&quot;Time spent debating the impossible subtracts from the time during which you
can try to accomplish it.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top