First, which form's code module are you running the code from?
Second, beware that you must refer to the subform control which, depending on how you added the subform, may be named differently (eg: 'Child0') from the form it uses as its SourceObject.
To find the name of the subform control...