View Full Version : eferencing a subform with a query as the recordsource


chad.bowen
09-04-2008, 06:34 PM
I have struggled with this issue for a couple of hours and have not been able to find the answer through various post, and hoping someone can help to answer this question

I have a form that is unbound, and a subform that has a query as the source object.
the subform control is named child0 and has the
sourceobject property = Query.qryComCdADept

The Query has a subdatasheet (based on another query) and the subdatasheet has another query in a subdatasheet

I want to reference the values that are in the subform, both the top level query and its child.

I can reference the top level with
Me.Child0.Controls("DeptName").Value

but I can not determine how to select the next level down. I have read many post on how to reference nested subforms, but have not seen how to do this if there is only one subform which has nested queries.

If the example below is readable I want to reference the value of currently selected row for the column ComCode.

Any help would be appreciated.

Example layouts are attached as jpg or xls file. Formatting got lost when pasting this into the posting window

file:///C:/Users/cbowen/AppData/Local/Temp/moz-screenshot.jpgfile:///C:/Users/cbowen/AppData/Local/Temp/moz-screenshot-1.jpg

wazz
09-04-2008, 06:50 PM
http://www.access-programmers.co.uk/forums/showthread.php?t=155901

chad.bowen
09-04-2008, 07:03 PM
Hi Wazz,

Thanks for speedy reply with the link to expression builder. I also find looking at the locals pane a good way to see what my objects methods and there values.

I have been through the object model reference and all of the control object members and do not see how to reference the child records of the query.

If you have any other advice would be much appreciated.