update subform from main form

jguillen

Registered User.
Local time
Today, 12:41
Joined
Dec 2, 2007
Messages
21
I know this has been asked before but can seem to find the right answer to my problem.
I have a main form with a subform, subform with the control source from a query based on the parameter of the data entry in 2 fields in the main form.
It work good but only updates when I move from one record to other, I need to update the subform after the data is enter in the fields, to reflect the new entry in the subform before moving to next record.
I know I need to do a requery event procedure on exit on the last field that the query gets its parameter values, just don’t know how to do this.
 
In the After Update event of the control(s) that you want to have the subform requeried put

Me.YourSubformContainerName.Form.Requery

where YourSubformContainerName is the name of the control that houses the subform on the main form (it may, or may not, be the same as the subform name).
 
Thank Again Bob I did put the code in afterupdate event, and it seams lke it requery the subform, but it does not update!, I used a macro on the subform container to requery in the on enter event and it does refresh the data, but of course i need to click on the subform to triger the macro.
do I need to put a refresh comand on the comand control that requery the subform from the mainform?
 
I did put a refresh comand after the code and did the trick.
Again thank very much for the help.
 

Users who are viewing this thread

Back
Top Bottom