Can't get subform to synch with Parent

G

Guest

My subform is not loading the correct data when I load patient data form a
search screen. When I initially open my main form by way of the search form
(switchboard>searchScreen>Main form with sub form) the correct data loads.
But on subsequent searches from the main form, the sub form still has the
prior patients data in it. My main and sub are related by the fldPINo in the
parent form and fldPINo in the sub form (the tables as well). Everything is
the way it is supposed to be (I believe.) So it make absolutetly no sense for
this to be happening. I have ME.Refresh in the fsub's OnCurrent event. I try
to requery the fsub's record source thru the main forms OnCurrent event using
Me.frmVisitNewEdit.Requery I'm absolutely baffled. On the sub form I have a
lstbox that displays all the visits of the loaded patient and it displays the
correct data, when I click on a record in the lst the corresponding data
loads into the sub form (because I have Me.Requery in the click event of the
lst.) So this makes me think I need to requery my sub forms data source. But
when a new patient is loaded into my main form, shouldn't the linked subform
also be loaded with that patients data?

This totally wierd. Any help would be greatly appreciated. Thanks, Rob
 
M

Marshall Barton

RobUCSD said:
My subform is not loading the correct data when I load patient data form a
search screen. When I initially open my main form by way of the search form
(switchboard>searchScreen>Main form with sub form) the correct data loads.
But on subsequent searches from the main form, the sub form still has the
prior patients data in it. My main and sub are related by the fldPINo in the
parent form and fldPINo in the sub form (the tables as well). Everything is
the way it is supposed to be (I believe.) So it make absolutetly no sense for
this to be happening. I have ME.Refresh in the fsub's OnCurrent event. I try
to requery the fsub's record source thru the main forms OnCurrent event using
Me.frmVisitNewEdit.Requery I'm absolutely baffled. On the sub form I have a
lstbox that displays all the visits of the loaded patient and it displays the
correct data, when I click on a record in the lst the corresponding data
loads into the sub form (because I have Me.Requery in the click event of the
lst.) So this makes me think I need to requery my sub forms data source. But
when a new patient is loaded into my main form, shouldn't the linked subform
also be loaded with that patients data?


Subforms should be linked through the subform control's Link
MasterChild Fields properties, not via criteria in the
subform's record source, no code needed.
 
G

Guest

the sub form is linked throught the Link MasterChild Fields properties. The
same problem occurrs. I am lost.
 
M

Marshall Barton

Get rid of all the Refresh and Requery stuff and check the
Link Master/Child properties again. Make sure the control
(text box?) used as the LinkMaster is bound to the
appropriate (primary key?) field in the main form's record
source.

IF you are changing some critical properties such as
RecordSource, SourceObject, Filter, ..., use breakpoints to
make sure the LinkMaster/Child haven't been reset.
 

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