change record source

S

seeker

I have a form OutreachMenu_F which has a form F_time_on_forms within that is
titled F_time_on_forms_subfrm whose source object is f_time_on_forms. I want
to change the recordsource for the F_time_on_forms and have used all of the
following to no avail:

forms!outreachmenu_F!f_time_on_forms.recordsource = strrecordsource
forms!outreachmenu_F!F_time_on_forms_subfrm.recordsource = strrecordsource

the error is that it cannot find F_time_on_forms. Before I added the new
implementation F_time_on_forms_subfrm.requery worked. How do I change the
recordsource for a form that is within a form?
 
M

Marshall Barton

seeker said:
I have a form OutreachMenu_F which has a form F_time_on_forms within that is
titled F_time_on_forms_subfrm whose source object is f_time_on_forms. I want
to change the recordsource for the F_time_on_forms and have used all of the
following to no avail:

forms!outreachmenu_F!f_time_on_forms.recordsource = strrecordsource
forms!outreachmenu_F!F_time_on_forms_subfrm.recordsource = strrecordsource

the error is that it cannot find F_time_on_forms. Before I added the new
implementation F_time_on_forms_subfrm.requery worked. How do I change the
recordsource for a form that is within a form?


Two important points about that. One is that you must use
the subform **control** name, which may or may not be
different from the name of the form object displayed in the
control.

Second, you should use the Form property:
forms!outreachmenu_F!f_time_on_forms.FORM.recordsource=strrecordsource

I hope it's not relevant to your question, but a third point
is when you are posting code/query/expression, use
Copy/Paste so we can avoid discussing what may turn out to
be a posting typo.
 
G

gael

Marshall Barton said:
seeker said:
I have a form OutreachMenu_F which has a form F_time_on_forms within that
is
titled F_time_on_forms_subfrm whose source object is f_time_on_forms. I
want
to change the recordsource for the F_time_on_forms and have used all of
the
following to no avail:

forms!outreachmenu_F!f_time_on_forms.recordsource = strrecordsource
forms!outreachmenu_F!F_time_on_forms_subfrm.recordsource = strrecordsource

the error is that it cannot find F_time_on_forms. Before I added the new
implementation F_time_on_forms_subfrm.requery worked. How do I change the
recordsource for a form that is within a form?


Two important points about that. One is that you must use
the subform **control** name, which may or may not be
different from the name of the form object displayed in the
control.

Second, you should use the Form property:
forms!outreachmenu_F!f_time_on_forms.FORM.recordsource=strrecordsource

I hope it's not relevant to your question, but a third point
is when you are posting code/query/expression, use
Copy/Paste so we can avoid discussing what may turn out to
be a posting typo.

je pas
Marsh
MVP [MS Access]
 

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