For example:
If CurrentProject.AllForms("Suppliers").IsLoaded = True Then
.
End If
This code checks to see if the form called Suppliers has been loaded in the current Access session.
Here is an example of how we've used IsLoaded.
Function GetCity() as string
If CurrentProject.AllForms("Suppliers").IsLoaded = True Then
GetCity = Form_Suppliers.txtSupplier_City
Else
GetCity = ""
End IfEnd Function
This function is used to retrieve the value of the txtSupplier_City in the Suppliers form.
If the Suppliers form is loaded, it will return the value in the textbox called txtSupplier_City. If the form is not loaded, it will return a blank value. This helps us avoid errors if we try to access the txtSupplier_City value when the Suppliers form is not loaded.
You can then use this function in a Query or a Report. or for that matter, anywhere within your Access database.