Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I "Refresh" Data Automatically? 1

Status
Not open for further replies.

missjen

Programmer
Jan 25, 2001
6
US
I have a combo text box on a (datasheet view) sub-form that selects its data from a field in a table that is separate from the underlying sub-form record source. I have the sub-form control's "Limit to List" property set to "No". When the user discovers the value they are trying to enter is not in the underlying list (by the pop-up notification after the attempt), they have the option of adding the value to that table by returning to the main form and clicking on a "Add to List" Macro button I have placed right next to the sub-form. This button opens up another form that is linked to the table where the list fields are stored. After adding the new record/list item, the form is closed.

My problem is, after the new record is added to the list, I am still unable to add this added item to the sub-forms' combo-box field - because the underlying table has not "refreshed" itself. I have to close and re-open the main form for it to appear in the list.

Is there a way to automatically update records that have been added to a combo-box list source? I think this is called "Refresh" - or at least it used to be, but there is nothing in Help that explains it.

Thanks in advance!

missjen
 
Add the following to the On Close event of the form where you added the record.

On Error Resume Next
Forms!FormReturningToName!ComboboxName.Requery

If the form you would be returning to(i.e. you opened this form by itself) then the error that the form isn't open will be bypassed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top