setting the rowsource on a subform

  • Thread starter kscheu via AccessMonster.com
  • Start date
K

kscheu via AccessMonster.com

I have a mainform called frm601Main and two sub forms called frm601sub1 and
frm601sub2. I have one combo box on the main form and I want to set the
rowsource property of frm601sub1 as follows:
[Forms]![frm601Main]![frm601Sub].[Form].Rowsource = "select * from Qrpt101
where div_code = me.cboDivision" I get the following error:
Can't find the field frm601sub. What am I doing wrong?

I also can't seem to reference the parent object when using the following
code on the frm601Sub1's On Current Event as follows:

Me.Parent![frm601sub1].Requery

Please help!

thanks.
 
J

John Vinson

I have a mainform called frm601Main and two sub forms called frm601sub1 and
frm601sub2. I have one combo box on the main form and I want to set the
rowsource property of frm601sub1 as follows:
[Forms]![frm601Main]![frm601Sub].[Form].Rowsource = "select * from Qrpt101
where div_code = me.cboDivision" I get the following error:
Can't find the field frm601sub. What am I doing wrong?

I also can't seem to reference the parent object when using the following
code on the frm601Sub1's On Current Event as follows:

Me.Parent![frm601sub1].Requery

You can't set the Rowsource property of a Form - do you mean the
Recordsource? A Form has a Recordsource; a Combo Box or Listbox has a
Rowsource.

Is frm601sub1 the Name property of the Form you're using as a subform,
or the Name property *of the Subform control* containing that form?
It's the latter that you need in both these cases.

John W. Vinson[MVP]
 
K

kscheu via AccessMonster.com

Hi John,

Thanks for responding so quick. The problem is that the form name and the
sub form control on the main form were named the same.

Thanks.

John said:
I have a mainform called frm601Main and two sub forms called frm601sub1 and
frm601sub2. I have one combo box on the main form and I want to set the
[quoted text clipped - 7 lines]
Me.Parent![frm601sub1].Requery

You can't set the Rowsource property of a Form - do you mean the
Recordsource? A Form has a Recordsource; a Combo Box or Listbox has a
Rowsource.

Is frm601sub1 the Name property of the Form you're using as a subform,
or the Name property *of the Subform control* containing that form?
It's the latter that you need in both these cases.

John W. Vinson[MVP]
 
J

John Vinson

Thanks for responding so quick. The problem is that the form name and the
sub form control on the main form were named the same.

Hm. That's actually the default if you let Access create the subform
and it usually doesn't cause problems - my worry was that they were
different and that you might have been using the Form name rather than
the subform Control name.

What was your final solution?

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top