Subform problem - legacy db tables
Posted: Mon Oct 19, 2020 3:07 am
I'm ashamed that I can't figure this out, I have a long DB history, but something here is puzzling and I can't quite get "behind the covers" to see what is going wrong. So I am hoping someone may be able to offer some help.
This is for a legacy database that I am trying to create a simple viewer application for. It has many tables of related data, and unfortunately they used the same field name for the key in all the tables. I did read in the user guide that "If a Subform's Form has an Object with the same ID as the Subform's Foreign Key, Subform records cannot be saved.", but I am not planning on any saving, just viewing, so I thought that may be a non-issue.
However, I can't get anything in the subform to display, and after watching videos I just can't seem to quite figure out how this is supposed to work.
Assume I have one table with the donor name/address information with the donor_id field. I have a from filling a browse form that is searchable, and an "edit" form with all the fields being either marked read-only or Display fields pulling in related data from some other tables.
I want to create a subform that displays the donor giving history. The gifts table uses the same donor_id field name. I think this is the problem, but I see no errors in the debug log, but no data fills in the subform.
I created an object on the form of type subform, and in the Subform section I picked the subform, the foreign key is donor_id and I have set Addable/Deleteable as No, Type as Grid.
In the Forms editor, I have set the gifts table name, the primary key is set to donor_id. For Browse, I have the columns for donor_id (don't really need it for display here), the gift date and gift amount with the database field names for them. In the SQL tab I have a query set to retrieve those fields from the gifts table with a where condition that the donor_id is equal to #RECORD_ID#.
Can someone please tell me just how badly I've messed this up and how to make It work? There are many other tables of related donor information, but they would all follow this same pattern, so if I get this to work the rest of the project should be fairly simple.
This is for a legacy database that I am trying to create a simple viewer application for. It has many tables of related data, and unfortunately they used the same field name for the key in all the tables. I did read in the user guide that "If a Subform's Form has an Object with the same ID as the Subform's Foreign Key, Subform records cannot be saved.", but I am not planning on any saving, just viewing, so I thought that may be a non-issue.
However, I can't get anything in the subform to display, and after watching videos I just can't seem to quite figure out how this is supposed to work.
Assume I have one table with the donor name/address information with the donor_id field. I have a from filling a browse form that is searchable, and an "edit" form with all the fields being either marked read-only or Display fields pulling in related data from some other tables.
I want to create a subform that displays the donor giving history. The gifts table uses the same donor_id field name. I think this is the problem, but I see no errors in the debug log, but no data fills in the subform.
I created an object on the form of type subform, and in the Subform section I picked the subform, the foreign key is donor_id and I have set Addable/Deleteable as No, Type as Grid.
In the Forms editor, I have set the gifts table name, the primary key is set to donor_id. For Browse, I have the columns for donor_id (don't really need it for display here), the gift date and gift amount with the database field names for them. In the SQL tab I have a query set to retrieve those fields from the gifts table with a where condition that the donor_id is equal to #RECORD_ID#.
Can someone please tell me just how badly I've messed this up and how to make It work? There are many other tables of related donor information, but they would all follow this same pattern, so if I get this to work the rest of the project should be fairly simple.