Pass NotInList value from subform to another subform

G

Gil D.

Hello,

In FormASubform I have a combobox.
When the user trying to add NotInList value I open FormB.
How can I pass new data to a field in FormBSubform ?

Thank you
Gil D.
 
M

Marshall Barton

Gil said:
In FormASubform I have a combobox.
When the user trying to add NotInList value I open FormB.
How can I pass new data to a field in FormBSubform ?


Use the OpenForm method's OpenArgs argument.

Then use the from's Load event to set the control's value:

Me.textbox = Me.OpenArgs
Me.textbox.locked = True

The reason to lock the text box is to prevent users from
changing what was typed in the combo box. If they did
change it, you will get another not in list because what was
typed still wouldn't be in the list.

You need to set the OpenForm method's WindowMode argument to
acDialog so the NotInList procedure waits ubtil the form
closes.

Also, set the DataMode argument to acFormAdd so users can't
edit other records in the list.
 
G

Gil D.

Hello,

Thank you for your help. I have another question.
I am using the OpenForm method's OpenArgs argument but I need to pass
the Args
to a subform in the opened form.
Can I use Me.textbox = Me.OpenArgs in the subform load event or I
should pass it from the opened form to the subform ?

Thank you
Gil D.
 
M

Marshall Barton

Gil said:
Thank you for your help. I have another question.
I am using the OpenForm method's OpenArgs argument but I need to pass
the Args
to a subform in the opened form.
Can I use Me.textbox = Me.OpenArgs in the subform load event or I
should pass it from the opened form to the subform ?


OpenArgs becomes a property of the open foe, so, No, you can
not pass it to the subreport directly. On the other hand,
the subform cab get to it very easily:

Me.textbox = Parent.OpenArgs
 

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