Log in

View Full Version : Solved: Add record in Sub Form, not available in Main Form



MichaelH
09-26-2005, 04:31 AM
Hi everyone,

I hope this is a clear description of where I seem to have a problem.

Main form has drop-down to select a CUSTOMER.
Main form also has sub-form to maintain / add new customers.

When I add a new Customer on the Sub-Form, it doesn't appear in my drop-down unless I close the form and re-open.

Is there a way to get an 'immediate' visibility of newly added CUSTOMERS?

Thanks
Michael

chocobochick
09-26-2005, 07:09 AM
Yep! In VBA, you need to call the Requery method of the Form object. Simply place the line "NameOfMainForm.Requery" at the end of any applicable code or event that alters data from the table, and you should be all set.

MichaelH
09-26-2005, 07:39 AM
Cheers chocobochick, I'll give it a try.

BR
MIchael

PS luv the name

chocobochick
09-26-2005, 08:14 AM
Correction: Upon rereading your original message, I realized you only need to requery the control, not the form. In this case, your code should probably read "NameOfMainForm.NameOfComboBox.Requery".

P.S. Thanks. My typical username in various forums has usually been chocobochicken. However, VBX only accepts 12 letters in a username, truncating it to chocobochick, which is somewhat unfortunate as it can potentially lead to misinterpretations of my gender. Oh, well.