Requerying a Subform

RXX00

Registered User.
Local time
Today, 18:18
Joined
May 24, 2011
Messages
26
Having trouble requerying a sub form

Parent - [F_TL_SUMMARY]
Child - [F_TL_SUMMARY_DETAIL]

My code - Forms![F_TL_SUMMARY]![F_TL_SUMMARY_DETAIL].Requery

Donesnt work.

Advice?
 
Try this:

Code:
Forms![F_TL_SUMMARY]![F_TL_SUMMARY_DETAIL].Form.Requery
 
The subform control is the control on the main form that houses the subform. Its name is the name to reference in code and not the subform name. If the subform control, and the subform have the same name, that is okay but it isn't necessary. If the subform control and the subform have different names then you must remember to refer to the subform control , and not the subform itself, within your code. For example, if you have a subform container named subform1 on a main form named frmMain and your subform within the control is named sfrm_test your code to refer to a text box named txtTest on the subform would be:
Forms!frmMain.subform1.Form.txtTest = "Whatever"
 
The subform control is the control on the main form that houses the subform. Its name is the name to reference in code and not the subform name. If the subform control, and the subform have the same name, that is okay but it isn't necessary. If the subform control and the subform have different names then you must remember to refer to the subform control , and not the subform itself, within your code. For example, if you have a subform container named subform1 on a main form named frmMain and your subform within the control is named sfrm_test your code to refer to a text box named txtTest on the subform would be:
Forms!frmMain.subform1.Form.txtTest = "Whatever"

I know this is a simple and prob stupid question, but what is the difference between a subform name and a subform control? :confused:
 
I know this is a simple and prob stupid question, but what is the difference between a subform name and a subform control? :confused:
A subform is a control on a form, just as a textbox is also a control on a form.

The textbox has a “Name” property and a “Control Source” property. The “Name” property is used when you refer to it in code and the “Control Source” property is where the data for that control comes from.

The subform is also a control on the form and also has a “Name” property but the subform control doesn’t hold data, it displays another form. The name of the form being held/shown in the subform control is used as the “Source Object” property of the subform control but the "Name" property of the subform control is what you use when you need to refer to the subform. The “Source Object” property and the "Name" property of the subform control may or may not be the same.
 
I know this is a simple and prob stupid question, but what is the difference between a subform name and a subform control?
confused.gif

Take a look at the screenshot on my tutorial on my website:
http://www.btabdevelopment.com/ts/ewtrhtrts
 

Users who are viewing this thread

Back
Top Bottom