Microsoft Access 2002

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I change an item in the background table of my form, I want the change to immediately reflect in my form's combox box. How can I accomplish this?
 
MCarter said:
When I change an item in the background table of my form, I want the change to
immediately reflect in my form's combox box. How can I accomplish this?
You can have code in the form that issues a Requery against the ComboBox, but
there is no way to automatically trigger that from an entry in the table since
tables have no events. If you created a popup form to make the entry then it
would be easy. It's really not a good idea (except perhaps during development)
to do anything directly with the tables.
 
First create a query based on the background table and
set the combo box Row Source Property to the query.
Next, for whatever element is being changed in the form
(for example, a text box), go to that element's (the text
box) On Change Event Property.

Me.comboboxname.Requery

The above code says that when the (text box) data is
changed, then the combo box needs to be requeried. This
should resolve your issue.
-----Original Message-----
When I change an item in the background table of my
form, I want the change to immediately reflect in my
form's combox box. How can I accomplish this?
 
You don't say how you are doing the update.

If you use the not in list event to trigger this addition, then the event
can re-load, and re-query the combo box for you (this is built in feature).

Private Sub Distributee_NotInList(NewData As String, Response As Integer)

if MsgBox("Do you want to add this value to the list?", _
vbYesNo) then
DoCmd.OpenForm "frmAddClient", , , , acFormAdd, acDialog
Response = acDataErrAdded
Else
Response = acDataErrContinue
End If

End Sub

Note the Response = acDataErrContinue, this instructs access to reload,
and re-query the combo
 
Back
Top