Passing Values Between Forms

ray_charles

Registered User.
Local time
Today, 18:13
Joined
Aug 5, 2002
Messages
18
Ok. I have been searching/reading for the last hour and have not found what I am looking for. Hence this question :-)

I am entering a Persons Name on the fly in a combo box, and,
use the notonlist VB code to open a new People Form, Add the
new name, and then pass a formatted name field back to the
calling combo box. Everything is working fine. I call a different
Add form each time, and set values on the combo boxs
explicitely naming the form and combo box control and setting the value.

But . . . to be more efficient, I think it would be better to have
ONE and only One Add form, then return a output parameter
that any calling combo box control on any form could read?

I know how to pass a opening argument to a form, but, how
in the world do I RETURN a output argument/parameter back
to the calling combo box control?????????


Ahhhhhhhhhh ! ! ! !

Thanx in advance . . . . ray . . . .
 
How about adding the new name to a table using the add form and then when you return to the combo form requerying the combo to find the additional name?
 
Might be worth a try :-) Thanx.
 
If you want to be able to determine how a form was opened, use the OpenArgs argument of the OpenForm Method. When you open the form as a result of the NotInList event, pass some value in the OpenArgs. Then in the Persons form, check the OpenArgs for a value. If it is null, it was opened directly. If it is not null, it was opened by another form.

If Not IsNull(Me.OpenArgs) Then
requery the combo
End If

If you want to call the form from multiple places, pass the actual form reference so that your requery can requery the correct form's combo.
 

Users who are viewing this thread

Back
Top Bottom