I am currently designing a database in Access 2007 and one of the forms I have has a combo box where the data for populating it is gotten from a table.
I have the limit to list property set to Yes and what I am trying to do is set the Not in List event to ask if the user wants to add the item to the list, if yes is selected it will open the data entry form for entering the item into the relevant table then, when the data has been entered, refresh the combo box so it shows the new addition.
My code (in VBA) for this is:
Private Sub Title_of_product_NotInList(NewData As String, Response As Integer) Dim Msg As String Msg = MsgBox("Add " & NewData & " to Products?", vbQuestion + vbYesNo) If Msg = vbYes Then DoCmd.OpenForm "EnterNewProduct", , , , , acDialog Response = acErrDataAdded End If End Sub
According to my research this should acheive what I desire, but it is not, everything if fine until it comes to refresh the combo box to show the newly added item - it doesn't refresh.
Could anyone help? I can provide more info if needed.
Also, as an aside, would it be possible to set the relevant input on the pop up form to the new data being added so the user doesn't have to type it twice?
Thanks in advance!
This post has been edited by Astano: 25 February 2009 - 05:07 AM