changing subform recordsource based on "query" name selected on ma

G

Guest

Hi folks,

I've read quite a few articles on trying to do this and can't seem to be
able to get things to work.

I have a form "reportselection" where a user can input criterias and launch
the report selected in form!reportselection!reportlist. I have a second
field where the user can instead select a query and using the fields on the
form input his/her criterias.

What I would like to happen is that when the user changes the query box,
that the record source of the subform changes to match the fields already
configured in that particular query.

The name of the subform is searchresults

so I have tried using the "on change" and "afterupdate" property of the
field form!reportselection!query to make
forms!reportselection!searchresults.recordsource = me.query.

This however is not doing anything for me. I have toyed around with this
for the last few hours to no avail. If anyone has any idea how I can get
this done, it would be greatly appreciated.

The idea is that the user selects the query and the results of the subform
match that of the query itself in datasheet format.

Thanks,
 
G

Guest

This is a fairly common reference problem. Assuming the name of the subform
control on the main form is named searchresults, then all you need to do is
reference the form that is the source object of the subform control
forms!reportselection!searchresults.form.recordsource = me.query

If the name of the form that is the source object is searchresults, then you
need to change it to the name of the subform control.
 

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