March 6, 20169 yr Newbies Hi - I have a table - call it main table - in which the key field is a calculated fields and is a concatenation of 3 text fields. I then have a sub table with the same structure. I am trying to add records to main table from subtable where they don't already exist in maintable. I do this by relating sub table to main table by the key field. My script loops through sub table and where get(lasterror)="101" (ie record is not in main table) I add the record to maintable. Trouble is I can't update fields in main table. The key field is a calculated field so i can't set field directly - but I can't set any of the 3 text fields because FM tells me i have to set the key field first. Thanks for any help. Max
March 6, 20169 yr For one thing, you don't have to use the relationship in order to create a related record. You can load the required values into variables, go to a layout of the other table, create a new record and set the relevant fields to the values stored in the variables. For another, I don't see why you couldn't (and probably should) switch the relationship to use the three text fields as the match fields, and get rid of the calculation field. I am not sure where error 101 comes into this. Surely you can see if a related record exists by looking at IsEmpty ( RelatedTable::MatchField )?
Create an account or sign in to comment