How do you open a child form to display records that
match two different fields on the parent form?
This simple question has burned up most of my Saturday with no resolution, hence this posting.
A set has been defined between the parent and child tables for a 1:M relationship with the link of Topic_Id
I expected this to be somewhat straightforward, but after spending the this morning and afternoon experimenting, seek the guidance of someone who knows what they're doing.
Parent table
Child table
Topic_Id is indexed in both tables.
Question_No is NOT indexed for either table. Only occasionally will the child records need to be selected based on a field other than Topic_Id.
When I press a button on the parent form I would like to open the child record with both the same Topic_Id and Question_No as the parent.
I'm using an Action Script to do this, so getting there HALF way is fairly simple.
Here's what I've entered for the Open Default Form or Browse Action Script:
The correct child records are displayed. So far, so good
But how do I select the one child record that has the same value of Question_No as the parent?
Is it possible to specify TWO selection criteria using the script genie, that is finding the records using the match on Topic_id, then using "Records selected fy a filter expression" to select from the returned child records the one form that also matches Question_No. Sounds like a reasonable approach, but I couldn't make it work.
So I guessed we're supposed to use the Records selected by a filter expression option.
I tried first just to filter the child records on one field, then on both fields. I never made it to second base.
In the Expression builder I created the following expression just using the F2 keys.
Note that I allowed Alpha to generate the expression, but I thought it curious that there was no table reference on the right side of the equation.
The filter failed; all records were returned not just the child records corresponding to the parent's Topic_Id.
Next I edited Alpha's filter to the following
which resulted in the error message:
"Invalid filter expression: TblChild->Topic_id = tblParent.Topic_id"
So I figured that the normal way of specifying a table.field must not apply to these filters so I replaced the period with -> as follows:
and you guess it got another error message:
"Invalid filter expression TblChild->Topic_Id = tblParent->Topic_Id"
I'm running out of alternatives. Can someone help me see the error in my ways?
Bob McGaffic
Pittsburgh
match two different fields on the parent form?
This simple question has burned up most of my Saturday with no resolution, hence this posting.
A set has been defined between the parent and child tables for a 1:M relationship with the link of Topic_Id
I expected this to be somewhat straightforward, but after spending the this morning and afternoon experimenting, seek the guidance of someone who knows what they're doing.
Parent table
Code:
Topic_ID Question_No Topic_Memo
Code:
Topic_Id Question_No Question_Memo
Question_No is NOT indexed for either table. Only occasionally will the child records need to be selected based on a field other than Topic_Id.
When I press a button on the parent form I would like to open the child record with both the same Topic_Id and Question_No as the parent.
I'm using an Action Script to do this, so getting there HALF way is fairly simple.
Here's what I've entered for the Open Default Form or Browse Action Script:
Code:
Selection criteria "Records that match the value in a control on the current form or report" Show records where the value in the field TOPIC_ID Matches the value in the control TOPIC_ID
But how do I select the one child record that has the same value of Question_No as the parent?
Is it possible to specify TWO selection criteria using the script genie, that is finding the records using the match on Topic_id, then using "Records selected fy a filter expression" to select from the returned child records the one form that also matches Question_No. Sounds like a reasonable approach, but I couldn't make it work.
So I guessed we're supposed to use the Records selected by a filter expression option.
I tried first just to filter the child records on one field, then on both fields. I never made it to second base.
In the Expression builder I created the following expression just using the F2 keys.
Code:
TblChild->Topic_id = Topic_id
The filter failed; all records were returned not just the child records corresponding to the parent's Topic_Id.
Next I edited Alpha's filter to the following
Code:
tblChild->Topic_Id = tblParent.Topic_Id
"Invalid filter expression: TblChild->Topic_id = tblParent.Topic_id"
So I figured that the normal way of specifying a table.field must not apply to these filters so I replaced the period with -> as follows:
Code:
tblChild->Topic_Id = tblParent->Topic_Id
"Invalid filter expression TblChild->Topic_Id = tblParent->Topic_Id"
I'm running out of alternatives. Can someone help me see the error in my ways?
Bob McGaffic
Pittsburgh
Comment