requery a subform?

kwtmd

Registered User.
Local time
Today, 11:57
Joined
May 21, 2004
Messages
46
I am updating records in a file by adding using recordset VBA code. These are displayed in a subform. I have tried all different combinations of requery without much success.... I know I just don't grasp the concept. Help.

I am using Forms!myformname.requery

It usually comes with an error that cannot find that form..... If I extract so to speak, the subform and use it as an separate form, the code works fine.
 
You seem to be requery the form (which you don't have open) instead of the subform.

Try
Me!SubForm.requery
where SubForm is the name of the subform in your main form

-Jake
 
I am still not getting this....

I have tried VBA code as suggested (I think) but still get errors that form cannot be found or object issues.... At what event should I be using the requery? At the on current?

As for the background issue, I am using an outside table and check boxes to select various records that are then saved into the form that the subform shows. If I close the form and reopen the form, the subform reveals the correct added records. I was hoping a requery would save me the trouble.
 
still unsuccessful. Error state it cannot find the form. The form/subform is open. What am I doing wrong?
 
Are you sure you typed the form name correctly in the code?
 
yes....

subform name is frmPatGoalProb


code:
forms!frmPatGoalProb.requery

produces --> Access can't find the form.....

the main form with subform are open. I have tried placing code in main form, subform and tried various combinations of the Me!frmPatGoalProb.requery.... without success.....
 
Try this:
Forms![main form name]![subformname].Requery
 
tried it but it still states it cannot find the subform?
 
You need the name of the subform as it appears on the main form property sheet and not in the db window.
Use the code builder to get the syntax correct
 
Thanks.... the answer was using the name of the form that the main form referenced. I had changed the name of the frmPatGoalProb to "Goal"... it now works. Why I changed the name I'll never know. Thanks to all of you for your perserverance....
 

Users who are viewing this thread

Back
Top Bottom