Can't Requery Combo Box on Subform

M

Mus

I wrote some code that executes on Not in List for a combo box. It opens a
form (dialog mode) that allows me to enter new data into the table that
provides data for the combo box. The last thing that happens is a requery on
the combo box.

This all works fine for combo boxes on a simple form. It doesn't work with
a combo box on a sub form. When I try it, I get "Index or primary key can't
contain a null value" after closing the dialog. The combo box doesn't
contain the new data; however, if I manually go to the menu bar and do a
Records-Refresh the data shows up and everything's fine. How do I get the
combo box to refresh on the sub form using VBA code? Currently I'm doing:
Combo2.Requery. It executes ok, just doesn't seem to do anything.
 
K

Ken Snell \(MVP\)

Forms!MainFormName!SubformControlName!ComboBoxName.Requery

where SubformControlName is the name of the subform control (the control
that holds the actual subform on the main form).
 
Top