Force MS Access to reflect new values?

  • Thread starter Thread starter Grahammer
  • Start date Start date
G

Grahammer

This is probably a dumb question, but...

.... I have some forms in MS Access (some with subforms). Some of the
controls are ComboBoxes that are bound to data in the database and allow
users to put in their own entries as well. When a user adds their own entry
I would like this choice to appear in the dropdown list.

Currently the new entries do not appear in the list until I close and reopen
the forms.

Is there any way to set these ComboBoxes to refresh automatically or do I
have to use VBA to tell the box to refresh when the CurrentRecord event
fires.

Thx!
 
You have to program the requery of the combo boxes yourself.

Use the AfterUpdate and AfterDelConfirm events of the form where new lookup
entries are made, to call the routine that looks for all forms that have
combo boxes based on that lookup table. If the form is open requery the
combo.

At the time when you develop a form, you don't know which other forms will
be dependant on it. So what we do is call a generic routine in
Form_AfterUpdate and Form_AfterDelConfirm in *every* form.

Once the app is nearly complete, we write this routine, which consists of a
huge Select Case structure. This kind of thing:

Public NotifyCombos(frm As Form, Optional iStatus As Integer = acDeleteOK)
Select Case frm.Name
Case "frmCategory"
If IsLoaded("SomeDependentForm") Then
Forms("SomeDependentForm").CateogryID.Requery
End If
If IsLoaded("...
 
Back
Top