Perhaps the simplest, but potentially bug-ridden way is to create some public variables (in a module) which are set as boolean & become true when each of the forms become open. When the subsequent form is called, you can set it to only ask for the parameter value if the correct form called it:
Module 1:
Public Form1Open as Boolean, Form2Open as Boolean
Public Form3Open as Boolean
Form1 Module:
Private Sub Form_Open()
Form1Open = True
Private Sub Form_Close()
Form1Open = False
Form2 Module:
Private Sub Form_Open()
Form2Open = True
Private Sub Form_Close()
Form2Open = False
Form3 Module:
Private Sub Form_Open()
Form3Open = True
Private Sub Form_Close()
Form3Open = False
Called Form Module:
Private Sub Form_Open()
If Form1Open = True Then
Add code here
ElseIf Form2Open = True Then
Add code here
ElseIf Form3Open = True Then
Add code here
End If
In theory this will test to see which form is open & subsequently which form is calling the next form. However it will get very confused if you have more than one of the forms open, so you could implement a similar method to ensure no other forms are open.
The alternate is to use DAO to test for the forms being open, & which is calling it. This is perhaps more thourough & less bug-ridden, but I think it is a lot more complicated, so I generall avoid using it.
James Goodman
j.goodman00@btinternet.com