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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding NEW items to a combo box after completeing input on other form 1

Status
Not open for further replies.

drfant

IS-IT--Management
Jun 22, 2009
4
US
I have 2 forms. Once is a form for entereing customer info and the other is for entereing products. When on the product form, there is a combo box that list the customers to select from. But the customer I want is not listed in the combo box. I have a button on the product form called "Add New Customer". When the user click on that button, I open up the customer form in add mode to add the customer. But when the database is updated and that customer form is closed, how to I update the combo form on the products page to reflect the new data that is on the table for customers, so the user can select the new item from the combo box?

Doing this saves haveing to close the product form, going to the switchboard and going to the customer form to add the data and navigating back to the product form.
 
Reset the RowSource property of the combo.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sorry, but your reply does not help. Reset the property to what? The current source is a query how do I trap for reruning that query when I come back to the product form?
 
What is the code of the "Add New Customer" button ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
So far this is as simple as it is.....

Private Sub AddNewCustomer_Click()
On Error GoTo Err_AddNewCustomer_Click

Dim stDocName As String

stDocName = "frmSubCustomerByName"

DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd

Exit_AddNewCustomer_Click:
Exit Sub

Err_AddNewCustomer_Click:
MsgBox Err.Description
Resume Exit_AddNewCustomer_Click

End Sub

=====

So when that form opens it is just in Add mode. The user enters the info, saves it and then closed the customer form.
 
Code:
Private Sub AddNewCustomer_Click()
DoCmd.OpenForm "frmSubCustomerByName", , , , acFormAdd, acDialog
With Me![[i]name of combo here[/i]]
  .RowSource = .RowSource
End With
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PH, Viola! It worked perfectly. Thanks very very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top