Error trying to populate subform from recordset

G

Guest

Using Office 2003 on Windows XP:

I am trying to set a subform to the results of a recordset, which I found on
Microsoft to use the following. I tested my SQL and it runs fine and returns
records.

I also double checked my subform name, in fact I copied it directly from the
property text box. I also checked it by popping the name up in a message box.
My assigment goes like this:

Me!sfrmMainPSFT.Form.RecordSource = sSQL

The above string appears in the AfterUpdate event of a combo box control
that appears on the main form. I get the error:

"Error 2467; The expression you entered refers to an object that is closed
or doesn't exist."

To be sure, I also set the focus to the subform right before trying to load
the SQL. This is driving me crazy; Microsoft says you can do it. Will someone
please tell me what I'm doing wrong? I'm begging...

Thanks -
 
G

Guest

Try Me![Parent form name]![Subform name].recordsource

I'm guessing that in doing it this way, your subform is not filtering
records on a primary key? If it is filtering, you should be able to simply
have the source of the form as the table of the records and then let your
parent/child linking filter the records for you.
 
G

Guest

Thanks, but this gives me error: 2465; can't access the field referenced and
it names my parent form name; therefore using this syntax, it thinks my form
is a field rather than a form.

The subform is not bound.

Do you have any other suggestions?

Pendragon said:
Try Me![Parent form name]![Subform name].recordsource

I'm guessing that in doing it this way, your subform is not filtering
records on a primary key? If it is filtering, you should be able to simply
have the source of the form as the table of the records and then let your
parent/child linking filter the records for you.

XP said:
Using Office 2003 on Windows XP:

I am trying to set a subform to the results of a recordset, which I found on
Microsoft to use the following. I tested my SQL and it runs fine and returns
records.

I also double checked my subform name, in fact I copied it directly from the
property text box. I also checked it by popping the name up in a message box.
My assigment goes like this:

Me!sfrmMainPSFT.Form.RecordSource = sSQL

The above string appears in the AfterUpdate event of a combo box control
that appears on the main form. I get the error:

"Error 2467; The expression you entered refers to an object that is closed
or doesn't exist."

To be sure, I also set the focus to the subform right before trying to load
the SQL. This is driving me crazy; Microsoft says you can do it. Will someone
please tell me what I'm doing wrong? I'm begging...

Thanks -
 

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