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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHAT FORM IS OPEN, LOADED?

Status
Not open for further replies.

mibeach7

MIS
Jun 18, 2003
35
US
HOW TO GET A FORM NAME THAT IS CURRENTLY LOADED, VISIBLE.

I AM TRYING TO GET A VALUE FROM A FORM WHEN I DONT KNOW WHICH FORM IS OPEN, BUT BOTH FORMS THAT COULD BE OPEN HAVE THE SAME NAME FOR THE INPUT BOX THAT HOLDS THE VALUE.

example : frmFORM1!txtInput.value
frmFORM2!txtInput.value

how to get txtInput when I am not sure which form is loaded?

Thanks, p1 at best....
 
You can determine all of the open forms by looking at the following collection

CurrentProject.Application.Forms

To check for a specific form by name, loop through the collection checking the value of .FormName property to see if it's loaded.
Code:
FormIsLoaded = False
For Idx = 1 To CurrentProject.Application.Forms.Count
   If (CurrentProject.Application.Forms(Idx-1).FormName = "frmYourFormName") Then
      FormIsLoaded = True
   End If
Next Idx



Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Here is what I used and it works good for this scenario! Screen.Activeform


Public Function frmGetValues()

Dim VAR_SD As Date, VAR_ED As Date
Dim E1, P1 As Integer
'Dim M1, Q1, S1, A1 As String

With Screen.ActiveForm
VAR_SD = Format(!ax_Start, "MM/DD/YYYY")
VAR_ED = Format(!ax_end, "MM/DD/YYYY")
'E1 = !CheckE1.Value
'P1 = !CheckP1.Value
'M1 = !OptionM1.Value
'Q1 = !OptionQ1.Value
'S1 = !OptionS1.Value
'A1 = !OptionsA1.Value
End With

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top