Synchroinizing the Data Source between Two Subforms

doulostheou

Registered User.
Local time
Today, 01:39
Joined
Feb 8, 2002
Messages
314
I have what I hope is an interesting problem. I have an unbound form that houses two subforms, which are linked to each other. The first (we'll call SubA) is a continuous form, showing the set of data that my users need quick access to. The second (SubB) is a single form, which shows details on the selected record from SubA. I have everything in place so that when you navigate to a new record in SubA it pulls up the appropriate record in SubB.

The way I accomplish this is through the link properties in SubB. The child field is set to ClaimsKey (the unique ID) and the Master field is set to SubA!ClaimsKey. I also added an event that fires on the Current event for SubA, which requiries SubB, thus bringing up the correct record whenever the user selects a new record.

Everything works great until you try to filter or sort SubA. At this point, the application breaks down and SubB stays stuck on the first record. I cannot figure out exactly why this is occurring, but I am suspecting it has something to do with the change in the data set that is occurring in SubA is not being mirrored in SubB and for some reason the inconsistency breaks the code.

My initial solution was to mirror the change in SortOrder and/or Filtering in SubB. However, I cannot find a form event that fires when the SortOrder or Filter options change in SubA. Any thoughts?
 
I want to apologize for taking so long to respond to this thread. I did not realize that alerts were being sent to an old e-mail address that is no longer valid.

I did want to let you know that I was able to fix this problem and the filtering is now working correctly. Thanks for your willingness to help!
 
would you be able to post how you solved the problem?
 
It's been so long that I'm not sure I remember exactly what the problem was. If I remember correctly, the error was not in my logic but just a general error in the code.

Everything is working correctly now. I requery subB on the onCurrent event of subA. The following is an excerpt of code that I use in a combo box to filter subA:

Select Case cboFilter
Case "All"
subClaims.Form.FilterOn = False
Case "Unreviewed"
subClaims.Form.Filter = "[DiscrepencyCode] Is Null"
subClaims.Form.FilterOn = True
Case "Problem Codes"
subClaims.Form.Filter = "[DiscrepencyCode] <> '14'"
subClaims.Form.FilterOn = True
End Select

Again, I can't remember exactly what was going on when I posted here originally, but I believe it was one of those things that when I figured it out, I was kicking myself for not seeing the mistake right away.
 
thanks, doulostheou,

i'm sure others have had this problem in the past and had no idea where to start unwravelling it - i certainly would not have thought about turning filters on and off in the code.

cheers,
wiklendt.
 
i think the point is that after you filter the old current row (which provided the effective link) may no longer be included in the filtered suba

now this may or may not generate a current event (im not sure) but it will certainly mean there is still an active row in suba, which you can still use to requery subb
 

Users who are viewing this thread

Back
Top Bottom