Subform's RecordSource under Access 2007 sp1

T

tao

Hi

I am testing a MS access app on Access2007 SP1. There a form which a sub
forms. The relationship like this:

MainForm include a SubForm, the SubForm has another SubForm1. So the
relation is:
Form: MainForm -> SubForm -> SubForm1
RecordSource: rsMain rsSub rsSub1

In Office 2000 & 2003, everything working fine. But when running on
2007. The SubForm1's RecordSource become blank on runtime. If I switch
to design view and switch back to Form view. It works fine again. It
seems Access 2007 just don't like the deep subforms.

I try to put the code like this on SubForm1's active event:
Me.RecordSource = "rsSub1"

Or SubForm's active event:
Me.SubForm1.RecordSource = "rsSub1"

It's just not work as the event never fire under SubForm1.

And in the mainForm, I try the code like this:

Forms![MainForm]![SubForm]![SubForm1].RecordSource

Access2007 just complain the object not exist at all. But if I test the
code like this:

Forms![MainForm]![SubForm]![SubForm1].Name

It can return "SubForm1"

I just don't what's going on with Access2007. How can I set RecordSource
correctly?

Cheers,

Tao
 
A

Allen Browne

I don't know if this will fix it, but try:

1. Open each form in design view in turn (sub1, sub, and main), and set the
new FilterOnLoad property to No for each one.

2. Try adding the .Form bit to your reference:
Forms![MainForm]![SubForm].Form![SubForm1].Form.RecordSource
Explanation of what this is:
http://allenbrowne.com/casu-04.html

If that doesn't work, use the Immediate Window (Ctrl+G) to find out what's
going on, e.g.
? Forms!MainForm!SubForm.SourceObject
? Forms!MainForm!SubForm.LinkMasterFields
? Forms!MainForm!SubForm.LinkChildFields
? Forms!MainForm!SubForm.Form.RecordSource
? Forms!MainForm!SubForm.Form.Filter
? Forms!MainForm!SubForm.Form.FilterOn
? Forms!MainForm!SubForm.Form.DataEntry
? Forms!MainForm!SubForm.Form.Recordset.RecordCount
and so on down to the next level.
 
T

tao

Hi Allen,

Thanks for your tip.

Once I change the code as your suggestion:

Forms![MainForm]![SubForm].Form![SubForm1].Form.RecordSource

Everything works great!

Cheers,

Tao
 

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