Adding Record via NotInList Event

  • Thread starter Thread starter marty
  • Start date Start date
M

marty

I have a combobox that will display a form to add a record
to the supporting table. This is activated by the
NotInList event. The display of the form seems to be
working fine.

My problem is that when I complete the form and save the
new record, the underlying table seems to be updated but
the drop-down list in the combobox is not. As a result,
the new entry just added is still considered invalid and I
get the form re-displayed.

Is there a way to ensure that the drop-down list is
updated when the new record is saved to the supporting
table?

Thanks.
 
The folwling works for me:


If MsgBox("Do you want to Add a new Tour/Invoice type?", vbOKCancel +
vbInformation) = vbOK Then

DoCmd.OpenForm "frmAddTourType", acNormal, , , acFormAdd, acDialog,
NewData

Response = acDataErrAdded

End If

Note that I set Response = acDataErrAdded.

This tells ms-access that you added new data, and to keep the current entry
that caused the not in list. Ms-access also re-quires, and re-loads the
combo box for you when you do this. So, that command does a whole bunch of
stuff for you.

In plain english, you need to tell ms-access that you added a new entry, and
you need to re-query the combo box. acDataErrAdded is how you do this.
 
Thank you for the help. I just wish the point you
describe was made clear in the help.
 
Back
Top