Results 1 to 2 of 2
  1. #1
    tortiman is offline Novice
    Windows 10 Access 2019
    Join Date
    Jan 2023
    Posts
    1

    Calculated fields in subforms

    Hi everyone, I am making a database for profits or loses in stocks. I have a table called tblOperational and this table is related with another three, tblBuys, tblSells and tblStops, the relationship are 1 to many since tblOperational because 1 operational can have many buys, many sells and many stops. By the other side, there is a table called tblCommission where i have the commissions that i have to pay to the broker, this commission can change with the time or the number of operations that i make, the relationship of tblCommission is 1 to many to the tables, tblBuys, tblSells and tblStops.



    I want to make a form with 3 subforms, subformBuys, subformSells and subformStops. The problem come when I want to calculate the commission in each subform for any buy, sell or stop. Imagine that I make a buy of 20 titles of AAPLE to 200$, the total of the operation is 4000$, over this 4000$ I have to calculate the commission using fields in the table tblCommission and the field totalOperation(4000$) of subformBuys. I make the next, in the subformBuys I put a independent textbox called txtCommission and using the expression generator put the next =[tblCommisssion]![percentage]*[tblBuys]![totalOperation]+[tblCommisssion]![valuefix].

    Well this should show me a amount of money but show me #¿Name?. I dont know what I am doing bad. Please help me because I think that is not difficult.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    better to show some example data and the outcome required rather than describing it.

    first glance, perhaps a typo? -
    tblCommisssion (3 s's?)

    second glance - you refer to controls in other subforms, not the table. Not clear whether
    tblCommisssion (for example) is the name of the subform or not. If it is then from another subform the reference would be

    parent.
    tblCommisssion.form.valuefix

    you might find this link useful
    http://access.mvps.org/Access/forms/frm0031.htm

    third glance - from your description, it does not seem like your structure is correct. At the very least I would expect the buys/sells to be in the same table, not separate tables. Same probably goes for stops. And I suspect you are missing a table between buys, sell and stops to commission

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 09-28-2019, 01:32 PM
  2. Replies: 1
    Last Post: 04-12-2017, 07:39 AM
  3. Fields duplicating in subforms of a form
    By Cornerdjh in forum Forms
    Replies: 3
    Last Post: 04-04-2016, 12:46 PM
  4. Replies: 12
    Last Post: 10-01-2013, 12:59 PM
  5. Replies: 4
    Last Post: 03-30-2012, 09:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums