Can't change recordsource in Form_Open in Access 2007

E

Eric

Hi,

I have an Access 2003 front-end that I am testing in Access 2007. In
Access 2003, I was able to set Me.Recordsource in the Form_Open event,
which would immediately trigger Form_Current. In 2007, I can't seem
to set the recordsource in the same way.

The recordsource is empty just before the line:

Me.Recordsource = "Select * from tblObject"

When I check the value of Me.Recordsource in the immediate window
immediately after executing this line, it is still empty. I verified
that tblObject is a valid linked SQL Server table. I also tried
setting it to a local Access table and a non-existent table. The
result is the same. The form in question is a subform.

Interestingly, I tried creating a form and subform from scratch in
2007, and it behaved as expected. That is, when I set Me.Recordsource
in the Form_Open of the subform, it changed immediately, and the
Form_Current event was fired right away.

Can anyone help?

Thanks in advance,
Eric
 
R

Rick A.B.

Hi,

I have an Access 2003 front-end that I am testing in Access 2007. In
Access 2003, I was able to set Me.Recordsource in the Form_Open event,
which would immediately trigger Form_Current. In 2007, I can't seem
to set the recordsource in the same way.

The recordsource is empty just before the line:

Me.Recordsource = "Select * from tblObject"

When I check the value of Me.Recordsource in the immediate window
immediately after executing this line, it is still empty. I verified
that tblObject is a valid linked SQL Server table. I also tried
setting it to a local Access table and a non-existent table. The
result is the same. The form in question is a subform.

Interestingly, I tried creating a form and subform from scratch in
2007, and it behaved as expected. That is, when I set Me.Recordsource
in the Form_Open of the subform, it changed immediately, and the
Form_Current event was fired right away.

Can anyone help?

Thanks in advance,
Eric

Eric,

I ran into something similar when converting a 2003 database to 2007.
The subform would not link to the main form. I had to recreate the
subform in 2007 then everything worked fine. I think I read something
about this but can't remember where. Probably a post here somewhere.
Suggest you just recreate the subform.

Hope that helps
Rick
 

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