Re: Calculated Fields Question for the prosPosted by webmaster Guido on February 15, 19103 at 15:11:39: In Reply to: Re: Calculated Fields Question for the pros posted by Peterson on February 14, 19103 at 19:57:55:
: I reference to my previous post; : In Table2 The Database consists of different agents with different Percentages. : Agent1 = 65% : Based on the record
in Table1 (which Agent is conducting the deal) I want to mathematicaly determine thier
commission and display it. --------------------- You didn't answer to my previous questions ;-) so it's impossible for me to figure out what is going wrong... Let me repeat, with some more explanations: Table2 must follow the "movements" of Table1. There are two ways to accomplish this: A. Automatically: link the TTable components in the Object Inspector, using the properties MasterFields and MasterSource of Table2. Let's look at the code snippet that you posted: procedure TForm1.Table1CalcFields(DataSet: TDataSet); As I saw no positioning of Table2 in your code, I assumed that you use automatic linking of the tables, as in method A above. But maybe you're not using any of the 2 methods? For any linking method, both tables must have an identical field (field "Agent" in the example, of type alpha-numeric) of the same size. Of course, all the values of Table1Agent must exist in Table2Agent. Further on, if you use automatic linking, or linking in code with a "FindKey" command, or GotoKey, or whatever code that requires an index, Table2 must be indexed on field "Agent". Of course, you could also write some positioning mechanism that doesn't require an index, but that's not recommended (would be more difficult, and works slower). |
|