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
 

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

Combo Box Fills In Calculated Text Box 3
Combo Box, Unbound Text Boxes 2
No Luck 1
Dependent forms 3
Refresh form while Open 6
Iif trouble 2
Setting Default Value in List Box 3
open form ubder conditions 3

Back
Top