Getting a combo box to show an update to a new record in a table (1 Viewer)

browninaz

Ugly Data Hoarder
Local time
Yesterday, 17:03
Joined
Oct 26, 2012
Messages
88
Hello everyone,

The answer to this would make my month! Let me see if I can explain this clearly.

I have a user form that has two unbound text box controls (txtSupplierName and txtSupplierNum) that have default values set from another form that opens this form. On the form that has the two unbound text box controls (the one in question), I have a subform (frmPurchaseDetailsSubform) with the usual purchase details fields (ex.- RetailCost, SalesTax, Discounts, etc.) and a couple of combo boxes that list items from tblProducts and tblSuppliers. When the user (or me) clicks the combo box to look at the list items and make an entry, and the list item is not present, I would like to add the item into the products table with a macro that opens the table. I have created a label control (and previously a button) with an event procedure that opens a form that allows the user to add a new record for the new product, but when I go back to the subform and click the combo box, the item is not updated or added on the list. I have played with every type of event procedure in the macro builder that I thought would make sense, and I can't seem to figure it out.

I don't have a lot of coding experience except to automate simple tasks, so I someone could explain to me how to do this with the macro builder, I would be most grateful.

Thanks to everyone who knows more than me...
 

cyanidem

Nieóhfytny jaszczomp
Local time
Today, 01:03
Joined
Nov 30, 2015
Messages
106
Have you tried

Me.YourComboBox.Requery

?

Edit:
sorry, didn't see a "macro builder" part. I never used it so no idea here.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:03
Joined
May 7, 2009
Messages
19,231
on your form's Unload or Close event where you add products, put a code, to requery your product combobox:

Private Sub Form_Unload()
Forms!formName!rmPurchaseDetailsSubform.Form!productComboName.Requery
End Sub

supply the correect form/control name on the above code.
 

browninaz

Ugly Data Hoarder
Local time
Yesterday, 17:03
Joined
Oct 26, 2012
Messages
88
Thanks a million arnelgp... This worked like a champ! I have been banging my head on this now on and off for some time. This saves me a bunch of time consuming work-arounds.

I love this forum!
 

Users who are viewing this thread

Top Bottom