NotInList Combobox & New Form

  • Thread starter Thread starter Rob Hofkens
  • Start date Start date
R

Rob Hofkens

Hello everyone :)

I am using the NotInList event of a combobox to add new data to the list.
I use another table as the rowsource of the combobox.

What I want is a new form whith which I can add the new entry and some extra
info to the table.
Then I want to return to the combobox and update the rowsource so that the
new enry is in the list.

My problem is that while I open the new form to add the new value, the
calling form continues and gives me the standard "not in list error".
Somehow I need to hold on the caling form and wait until the new data in the
new form is added.
I tried to make the new form modal but that didn't do the trick.

I hope I described the problem clear enough.

Any help would be apreciated :)

Thanx in advance,

Rob.
 
Rob said:
I am using the NotInList event of a combobox to add new data to the list.
I use another table as the rowsource of the combobox.

What I want is a new form whith which I can add the new entry and some extra
info to the table.
Then I want to return to the combobox and update the rowsource so that the
new enry is in the list.

My problem is that while I open the new form to add the new value, the
calling form continues and gives me the standard "not in list error".
Somehow I need to hold on the caling form and wait until the new data in the
new form is added.
I tried to make the new form modal but that didn't do the trick.


You need to open the new form with the WindowMode argument
set to acDialog. This will pause your not in list procedure
until the form is closed or made invisible.

You should set the DataMode argument to acFormAdd to go
directly to the new record. This will aso prevent existing
records from being modified.

I also suggest that you use the OpenArgs argument to pass
the new data from the combo box to the form. The important
point with this is to not only to remove an oportunity for
the user to make a mistake by retyping the value, but to
avoid the complications caused by the new record not
matching the combo box's new value and generating another
round of not in list errors. The code in the new form's
Load event would be something like:
If Not IsNull(Me.OpenArgs) And Me.NewRecord Then
Me.[the text box] = Me.OpenArgs
Me.[the text box].Locked = True
End If
 
Thank you very much Marchall :)

Very usefull information !

Rob.


Marshall Barton said:
Rob said:
I am using the NotInList event of a combobox to add new data to the list.
I use another table as the rowsource of the combobox.

What I want is a new form whith which I can add the new entry and some
extra
info to the table.
Then I want to return to the combobox and update the rowsource so that the
new enry is in the list.

My problem is that while I open the new form to add the new value, the
calling form continues and gives me the standard "not in list error".
Somehow I need to hold on the caling form and wait until the new data in
the
new form is added.
I tried to make the new form modal but that didn't do the trick.


You need to open the new form with the WindowMode argument
set to acDialog. This will pause your not in list procedure
until the form is closed or made invisible.

You should set the DataMode argument to acFormAdd to go
directly to the new record. This will aso prevent existing
records from being modified.

I also suggest that you use the OpenArgs argument to pass
the new data from the combo box to the form. The important
point with this is to not only to remove an oportunity for
the user to make a mistake by retyping the value, but to
avoid the complications caused by the new record not
matching the combo box's new value and generating another
round of not in list errors. The code in the new form's
Load event would be something like:
If Not IsNull(Me.OpenArgs) And Me.NewRecord Then
Me.[the text box] = Me.OpenArgs
Me.[the text box].Locked = True
End If
 
Back
Top