Can't Requery Combo Box on Subform

G

Guest

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).
 

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

Similar Threads

Requery combo box 4
Requery subform 1
code for combo box 1
subform combo box update, access 03 2
Requery Combo box in subform. 0
Requery 3
Synchronize 2 combo boxes 1
requery a combo box 2

Top