Default value

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!
 
O

Ofer Cohen

Try

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

Igor G.

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!
 
O

Ofer Cohen

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

Top