简体   繁体   中英

MS access Not In List event and Subform

I have created a survey form in ms access 2003 which have one main form and two subforms from 3 different tables. On the main form there is a combo box for patient ID and date field for date registered. when the patient ID is not in the list a the event fires and a pop up form appears where i can completer details of new ID and date and that new id will create a record in all 3 tables. My problem is after closing the popup form the combo box does show new data -ID but the subform which relates to the new ID does not update or refresh and does not show new ID. I need to close the main form and re-open and then i can select the new patient ID which will be shown on the subform as well. Can this be programmed so that i do not have to close the form? Help will be appreciated.

You can manually re-populate all controls from code by executing the following in VBA code of you form:

Me.Requery

As long as your form is opened you can access the form via AllForms collection. So, in your popping-up form you can just write in the OnClose-event the following code

Forms("NameOfYourMainForm").Requery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM