Access: Refresh the values in a combo box
Question: In Access, I've created a combo box that is populated by a code table. After I add a new value to the code table it doesn't appear in the combo box list. How do I refresh the values in a combo box?
Answer: Sometimes it is necessary for the user to update code tables while they are using the system. For example, if a user clicks on a combo box and the value that they are looking for is not present, you can set up the combo box to launch the corresponding code table on the combo box double-click event. The only problem with this is that you need to refresh the combo box values after the user has left the code table screen.
To do this, you will need to call the "Requery" method for the combo box.
For example:
Category.Requery
In this example, you have a combo box called Category. The Requery method forces the combo box to refresh the values that it lists.
In our example, you would place this code in the double-click event after the "docmd.openform" code. For example,
Private Sub Category_DblClick(Cancel As Integer)
'Open code table
DoCmd.OpenForm "CategoryCodes", acNormal, , , , acDialog
Form_Suppliers!Category.RequeryEnd Sub
So when the user double-clicks on the category combo box, the form called "CategoryCodes" would open. After the user has closed the CategoryCodes form, the category combo box would requery its values.
Link: Clic
Link en Castellano: Clic
Link de foros en Access en Castellano: Clic
No hay comentarios.:
Publicar un comentario