subforms not requerying

S

Stephen

I have a form with multiple subforms. Simply described, here is the layout

MAINFORM = main form, unlinked
SubformA = Linked to MAINFORM by unique RecordID
SubformB = Linked to SubformA by SubRecordID

I am viewing RecordID 999 on the MainForm and it clearly shows all of the
related SubFormA and SubformB records (related to SubformA via SubRecordID)

When I move to RecordID 998, SubFormA and SubformB records properly
requery, but SubformB ONLY requeries if there are records in SubformA.

When I move to RecordID 997 on the MainForm (which does NOT have any related
SubFormA records), the SubformA requeries showing an empty recordset, yet
the SubformB still shows the records related to RecordID 998 (hence it did
not refresh/requery)

In the OnCurrent property of SubformA, I have the SubformB.Requery code
(which works correctly)
It appears that when there are no records in SubformA, the OnCurrent
property is not executed, hence SubformB never requeries.

How do I get SubformB to requery (and thus show no records) when there are
no records in SubformA?

-Stephen
 
S

Steve Schapel

Stephen,

Unless I am missing something in your description, there is no reason to
be using Requery code, or any other code for that matter, associated
with this process. When you say, for instance, "SubformA = Linked to
MAINFORM by unique RecordID", I assume you mean that SubformA's Link
Master Fields and Link Child Fields properties are set to RecordID? And
similarly with the relationship between SubformA and SubformB? This
should automatically take care of the data displayed in the subforms as
you move from record to record on the MainForm, and the Current event is
not relevant.
 
S

Stephen

Steve-

I think your response sounds correct, but I cannot undersatnd why these
secondary subforms are not refreshing the data? Why might this be occuring?

You are corerct about the following:

SubformA's Link Master Fields and Link Child Fields properties are set to
RecordID
SubformB's Link Master Fields and Link Child Fields properties are set to
SubRecordID and Forms!MainForm!SubformA.Form.SubRecordID

Would you be able to provide somthing i can do to address the problem?

-Stephen
 
S

Steve Schapel

Stephen

I imagined that SubformB is a subform on SubformA. It now sounds like
this is not the case. Try it like this... Put an unbound textbox on
the MainForm, lets say we call it LinkerA, and put its Control Source as...
=[SubformA]![SubRecordID]
And then, set the Link Master Fields property of SubformB to [LinkerA]
and its Link Child Fields property stays (presumably) as [SubRecordID]
 
S

Stephan (Germany)

Hello,

I'm facing the same issue like Stephen (my name is Stephan :).

I tried the trick with additional textbox and linked the master field /
child field propertoes as you said.
The subform B is displaying preselected values according the actual selected
record in subform A, field SubRecordID which is one key column of the table
in subform B.

The only problem now is in subform B if I have more than one record selected
for SubCreodID: I cannot navigate to the 2nd, 3rd etc. record. The record
pointer will be set always to the first entry within subform B, the same like
calling requery each time. How can this situation now be improved?

Yours
Stephan.

Steve Schapel said:
Stephen

I imagined that SubformB is a subform on SubformA. It now sounds like
this is not the case. Try it like this... Put an unbound textbox on
the MainForm, lets say we call it LinkerA, and put its Control Source as...
=[SubformA]![SubRecordID]
And then, set the Link Master Fields property of SubformB to [LinkerA]
and its Link Child Fields property stays (presumably) as [SubRecordID]

--
Steve Schapel, Microsoft Access MVP

Steve-

I think your response sounds correct, but I cannot undersatnd why these
secondary subforms are not refreshing the data? Why might this be occuring?

You are corerct about the following:

SubformA's Link Master Fields and Link Child Fields properties are set to
RecordID
SubformB's Link Master Fields and Link Child Fields properties are set to
SubRecordID and Forms!MainForm!SubformA.Form.SubRecordID

Would you be able to provide somthing i can do to address the problem?

-Stephen
 
S

Stephen Lebans

Well I just had to drop in. Not too many threads where you get Stephan,
Steve and Stephen all together at once.<grin>

--
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephan (Germany) said:
Hello,

I'm facing the same issue like Stephen (my name is Stephan :).

I tried the trick with additional textbox and linked the master field /
child field propertoes as you said.
The subform B is displaying preselected values according the actual selected
record in subform A, field SubRecordID which is one key column of the table
in subform B.

The only problem now is in subform B if I have more than one record selected
for SubCreodID: I cannot navigate to the 2nd, 3rd etc. record. The record
pointer will be set always to the first entry within subform B, the same like
calling requery each time. How can this situation now be improved?

Yours
Stephan.

Steve Schapel said:
Stephen

I imagined that SubformB is a subform on SubformA. It now sounds like
this is not the case. Try it like this... Put an unbound textbox on
the MainForm, lets say we call it LinkerA, and put its Control Source as...
=[SubformA]![SubRecordID]
And then, set the Link Master Fields property of SubformB to [LinkerA]
and its Link Child Fields property stays (presumably) as [SubRecordID]

--
Steve Schapel, Microsoft Access MVP

Steve-

I think your response sounds correct, but I cannot undersatnd why these
secondary subforms are not refreshing the data? Why might this be occuring?

You are corerct about the following:

SubformA's Link Master Fields and Link Child Fields properties are set to
RecordID
SubformB's Link Master Fields and Link Child Fields properties are set to
SubRecordID and Forms!MainForm!SubformA.Form.SubRecordID

Would you be able to provide somthing i can do to address the problem?

-Stephen
 
S

Stephan (Germany)

Thanks for the "partnership" :).... but have you tried the textbox idea? Do
you get the same problem? What can be done instead?

Thanks
Stephan

Stephen Lebans said:
Well I just had to drop in. Not too many threads where you get Stephan,
Steve and Stephen all together at once.<grin>

--
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephan (Germany) said:
Hello,

I'm facing the same issue like Stephen (my name is Stephan :).

I tried the trick with additional textbox and linked the master field /
child field propertoes as you said.
The subform B is displaying preselected values according the actual selected
record in subform A, field SubRecordID which is one key column of the table
in subform B.

The only problem now is in subform B if I have more than one record selected
for SubCreodID: I cannot navigate to the 2nd, 3rd etc. record. The record
pointer will be set always to the first entry within subform B, the same like
calling requery each time. How can this situation now be improved?

Yours
Stephan.

Steve Schapel said:
Stephen

I imagined that SubformB is a subform on SubformA. It now sounds like
this is not the case. Try it like this... Put an unbound textbox on
the MainForm, lets say we call it LinkerA, and put its Control Source as...
=[SubformA]![SubRecordID]
And then, set the Link Master Fields property of SubformB to [LinkerA]
and its Link Child Fields property stays (presumably) as [SubRecordID]

--
Steve Schapel, Microsoft Access MVP


Stephen wrote:
Steve-

I think your response sounds correct, but I cannot undersatnd why these
secondary subforms are not refreshing the data? Why might this be occuring?

You are corerct about the following:

SubformA's Link Master Fields and Link Child Fields properties are set to
RecordID
SubformB's Link Master Fields and Link Child Fields properties are set to
SubRecordID and Forms!MainForm!SubformA.Form.SubRecordID

Would you be able to provide somthing i can do to address the problem?

-Stephen
 

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