Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requery diagram on subform..? 1

Status
Not open for further replies.

Kujen

Technical User
Oct 13, 2007
57
SE
Hi,

I have diagram on a subform and the subform is placed on a TabControl. I want the diagram to be updated when I change page on the TabControl.

* TabControl is called tabOrders
* FrmDiagram is the name of the subform control
* FrmDiagram is the name of the form inside the subform

If I run:
=============================================
Private Sub tabOrders_Change
Forms![FrmGrund1]!Form.[FrmDiagram].Requery
End Sub
=============================================
..I'll get "Can't find field 'Form'" error 2465

If I change to:
Forms![FrmGrund1]!Form.[FrmDiagram].Requery
..nothing happens.

What can be wrong?

Kent J.
 
Should be
formObject.subformcontrol.form.requery

Something like

Forms![FrmGrund1].frmDiagram.form.requery

the ".form" property returns the form within a subform control. This is a property not a member of a collection so you can not use "!". You do not need to use the name of the form within the subform because ".form" returns the object.
 
Hi,

Thanks but..
It was actually easier than I thought.
I should be just:
===============================
Private Sub tabOrders_Change
Me.Refresh
End sub
===============================
To update the diagram.

Kent J.
 
Yes, if you requery the mainform all subforms requery.
But you should understand how to properly reference a subform. There will be times when you have multiple subforms on a form and you would only want to requery one of the subforms. Need to understand the difference between referencing an item in a collection and a property.
 
Kujen . . .

Ditto's on solving your problem, but I agree with [purple]MajP[/purple] ... [purple]you should understand how to properly reference a subform ...[/purple][/blue][/quote]

Have a look here: Refer to Form and Subform properties and controls

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top