Is Form Open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In the open event of SpoilForm I have the following:
Dim Job As Integer
Job = Nz([Forms]![ProductionForm]![JobNumber])

I want to use the value from the ProductionForm if it is available. If the
ProductionForm is open I want to use the information from it to fill in the
SpoilForm JobNumber. If the ProductionForm is not open I want to bypass this
step and the information will have to be entered by the user.
How do I find out if the form is open?
Once I know if it is open can I set up a condition such as an If Then End IF.

Thank you for your help
Allan
 
This isn't the exact answer, but you can loop through the Forms collection.
I believe only OPEN forms appear in the forms collection, vs the AllForms
collection. But I am foggy on this and you should look up both.

Kurt
 
AHopper said:
In the open event of SpoilForm I have the following:
Dim Job As Integer
Job = Nz([Forms]![ProductionForm]![JobNumber])

I want to use the value from the ProductionForm if it is available.
If the ProductionForm is open I want to use the information from it
to fill in the SpoilForm JobNumber. If the ProductionForm is not
open I want to bypass this step and the information will have to be
entered by the user.
How do I find out if the form is open?
Once I know if it is open can I set up a condition such as an If
Then End IF.

Thank you for your help
Allan

If you're using Access 2000 or later, you can use code like this:

If CurrentProject.AllForms("ProductionForm").IsLoaded Then
Job = Nz([Forms]![ProductionForm]![JobNumber])
Else
' do something else?
End If

If you're using Access 97, there's a user-defined function called
IsLoaded() in the sample databases (Northwind and Solutions) that you
can call to find out.
 
Allan
You can try:
If (SysCmd(acSysCmdGetObjectState, acForm, "ProductionForm") And
acObjStateOpen) <> True Then 'form is open
'fill in the SpoilForm JobNumber
Else 'form is closed
' use inputbox function
End If

Cheers
Krock
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Textbox Filter 4
PopUp Form Help 6
Find First on Other Form 2
Enter Parameter Values Problem 1
Open form based on query result 4
Custom ID Field 4
Insert new value to a table 3
Open existing or new record 1

Back
Top