Access violation, Query and MDI

I have a MDIParent, creating MDIChildren in runtime. The MDIChild has a
DBGrid, a Datasource and a Query put together. A manage to show the
Query.SQL result in the grid if I put the code in MDIChild.OnCreate. If I
try to put the code in a procedure I got access violation error...I try to
reach the child with '(ActiveMDIChild as TChildMDIForm).Query.Close;' from
the parent form, same result...
Whats wrong?
Please help, thank you