Results 1 to 7 of 7
  1. #1
    bakkouz is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    25

    Access 2007 - Subform only calculates last field.

    Hi,
    I have a main form and a subform.
    The main form is based on an "items" table, and the subform is a continuous form based on a "subitems" table, they are lined via "item_id".


    in the subform I have the following controls: Item, Used, Available.




    The user chooses the "item" from a combo box, it automatically shows him the quantity of the item available in the "Available" field, then he enters the amount used in the "Used" field. I have set up an Invisible text box which stores the actual available amount with a formula to subtract the Used from the Actual, to prevent the Actual amount from being changed until the user presses the "Save" Button on the main form.


    This all works fine and well if the subform contains only one item. but if the user selects more than one item in the continuous subform, Access only calculates the last item entered. and doesn't apply the formula to all items in the subform.


    How do I solve this?
    Thanks.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Calculated values are not automatically saved to table because those controls are not bound. The Actual value will not be altered by the calculation alone. Code is required to save calculated value.

    Is Used a bound control?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    bakkouz is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    25
    No, They are bound.
    As I said, everything works fine, but only for the last item selected in the subform.
    it does not update all items. that's the problem.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Don't know what you mean by 'update'. Make the calculation control visible while you are testing. What is the formula? Are the calculations occurring? Can you provide project for analysis?

    Try this. Name the controls different from the fields they are bound to, like tbxUsed. Then refer to the control names in calculations.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    bakkouz is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    25
    Yes, I'll try and post it. just let me clean it up a bit

  6. #6
    bakkouz is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    25
    June,
    I've attached a copy of the accdb file.
    you must first select Dept, then SEction in the main form,
    then in the subform you must select: printer make then printer model then ink model> then enter a value in "Used"
    after update of "used" updates the value of the items in the inventory but only temporarily.
    the actual value of the items on the list should only be updated after clicking save on the main form.
    then in the subform try using the HP Color LaserJet 1600 as an example.
    hope it makes sense

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    This project opens to a form with choices Enter Items and View Items. I selected Enter Items. When I select Department (the only one offered is Administration) I get error message "The expression After Update you entered as the event property setting produced the following error: A problem occurred while Microsoft Access was communicating with the OLE server or ActiveX Control." I am not familiar with this error. Before I can select Section an input prompt pops up. I OK through it and try the Section combo, there are no choices. I tried to identify the control with the calculation but didn't see any controls with a calculation. Sorry, can't debug your project.
    Last edited by June7; 10-22-2011 at 02:14 AM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. new database that calculates workhours per empolyee??
    By manos39 in forum Database Design
    Replies: 0
    Last Post: 02-16-2011, 03:36 AM
  2. Replies: 9
    Last Post: 12-15-2010, 01:44 PM
  3. Replies: 3
    Last Post: 08-08-2010, 05:33 PM
  4. access 2007; sql query in a field?
    By cmdturk in forum Access
    Replies: 4
    Last Post: 12-16-2009, 10:25 AM
  5. Replies: 3
    Last Post: 03-27-2009, 06:50 AM

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