Default value

  • Thread starter Thread starter Igor G.
  • Start date Start date
I

Igor G.

I have two version of "main" Form (Form1... Form2) with Combo Box (Combo35).
From this form I open another form where Default Value in one Field (Text
Box) must be value from Combo35 in Form1 or Form2.
How to detect which form is open and use value from Combo35 in opened form
to default value in Text Box in second form?
Thanks!
 
Try

If CurrentProject.AllForms("FormName").IsLoaded Then
' Action if form is open
End If
 
I try some code in On Current properties, but without success...
What's wrong?

If CurrentProject.AllForms("Form1").IsLoaded Then
Me.txtLogIn.DefaultValue = Chr$(34) & Me.[Forms]![Form 1]![Combo35] &
Chr$(34)

If CurrentProject.AllForms("Form2").IsLoaded Then
Me.txtLogIn.DefaultValue = Chr$(34) & Me.[Forms]![Form 2]![Combo35] &
Chr$(34)

Else
....
End If
End If

Thanks!
 
Sorry for the delay,
In the criteria you used "Form1" and in the reference to the combo you used
"Form 1", with space between the name and number.

--
Good Luck
BS"D


Igor G. said:
I try some code in On Current properties, but without success...
What's wrong?

If CurrentProject.AllForms("Form1").IsLoaded Then
Me.txtLogIn.DefaultValue = Chr$(34) & Me.[Forms]![Form 1]![Combo35] &
Chr$(34)

If CurrentProject.AllForms("Form2").IsLoaded Then
Me.txtLogIn.DefaultValue = Chr$(34) & Me.[Forms]![Form 2]![Combo35] &
Chr$(34)

Else
....
End If
End If

Thanks!

„Ofer Cohen“ said:
Try

If CurrentProject.AllForms("FormName").IsLoaded Then
' Action if form is open
End If
 
Back
Top