Varifying that a form is open

bri822

Registered User.
Local time
Today, 20:43
Joined
May 23, 2002
Messages
31
I just started working on a complicated database that was handed to me after a few people have worked on it. I need to be able to edit a "Work Order" form. The database allows for it to be created, but not edited.
It's created after filling out required information in a "add packets" form. When the work order is created, a macro checks to make sure all the necessary information is in the fields on the add "add packets" form.
Upon making an "edit packet" screen, I am trying to open up the Work Order, but the macro is giving me errors since the "add packets" screen is closed. My thought was to go back to the macro and change it so that if the "add packets" screen was open, it would then check the fields in that form. If that form was not open, then it would check the fields in the "edit packet" form.

MY QUESTION: Does anyone know how to set up a condition on a macro so that it returns either true or false based on if a form is open????

Any help would be appreciated!!! Thank you
 
This isn't a macro, but ....create a module and place this code in it:

Function IsLoaded(strFrmName As String) As Boolean

' Determines if a form is loaded.

Const conFormDesign = 0
Dim intX As Integer

IsLoaded = False
For intX = 0 To Forms.Count - 1
If Forms(intX).FormName = strFrmName Then
If Forms(intX).CurrentView <> conFormDesign Then
IsLoaded = True
Exit Function ' Quit function once form has been found.
End If
End If
Next

End Function

Then when you are in your form, you can place code (such as on the On Close event):

if isloaded (frmYourForm) = true then
' action to perform if the form is loaded
else
' action to perform if the form is not

end if



[This message has been edited by Elana (edited 05-23-2002).]
 

Users who are viewing this thread

Back
Top Bottom