refresh combo boxes

  • Thread starter Thread starter ruben fazo
  • Start date Start date
R

ruben fazo

Guest
I've got a mechanism whereby the Not in List
event of a combo box invokes a form to add a new record to the underlying table. Is there a neat way to then requery not only that combo box but any others that may depend on the same table ? Simply to say field.requery seems to not to work. I get a message saying the current field must first be saved. What does it mean to save a field ? This is access 97 i'm talking about. Thanks for your time.
Ruben
 
If I'm understanding the problem correctly - you need to write some code to requery each of the controls on the mian form, on the close event of the smaller form. Once the smaller form closes the record will have been saved and your problem should be resolved.
 
There is one good method I use to requery, like what you are describing. If I understand correctly you have a combo box on a main form with a subform with viewable data in it. If this is the case you want to use the following code, works best in a close or save button, but can be added to the on close event.

Forms!mainformname.fieldname = Forms!mainformname.fieldname.Column(0, 0)
Forms!mainformname.fieldname.Requery

Another Example:

control.Column(column, row)

The Column property uses the following settings.

Setting Description
control A Control object that represents the active combo box or list box control.
column An integer that can range from 0 to the setting of the ColumnCount property minus one.
row Optional. An integer that can range from 0 to the setting of the ListCount property minus 1.
 

Users who are viewing this thread

Back
Top Bottom