Hi everyone
When I add fields from several datasources (ie. 2 datasources) onto 1 grid, I get the error 'Field1 must be filled in'. There are a million ways to resolve this problem I'm sure, but I want to make sure I'm not making a stupid mistake, and want to do it within Best Practice
I have three tables: A, B (with fields: PKField, Field1, Field2), ABLink (with fields RecIdOfA, RecIdOfB)
On the form I have a grid in which I display data from table A, and another grid on which I want to add/delete records in ABLink, but display data from B. So on my form, I add all three tables, I link ABLink to A, and I link B to ABLink with an inner join. I set the second grid's datasource property to ABLink, and I drag ABLink.RecIdOFB onto the grid. I also drag Field1 and Field2 of Table B onto the grid. I set the allowAdd, allowEdit, allowDelete properties of TableB to NO.
Everything works perfectly as far as displaying data is concerned, but when when I add a record in grid 2 and try to save the record, I get an error saying 'TableB.PKField must be filled in'. This happens because when I create a new record on the grid linked to ABLink, it also creates a record in TableB for some reason.
To resolve this I could,
- write display methods for Field1 and Field2 (but I want to avoid display methods in this case for performance)
- change the join type from inner to passive and then manipulate the relationships via active() or linkActive() etc
- I supposed there are several other ways too. But it all seems unnecessary. I'm sure it must be simpler. Can anyone see what I'm doing wrong? Inner oin seems to be the correct option, but I can't add a record correctly. What am I doing wrong?
Thanks