Results 1 to 9 of 9
  1. #1
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26

    Auto update in separate forms

    Got this form named "Stock" with a subform named "Stock Dismiss". In 'Stock' form, there are the total stock quantity values ( shop 1, shop 2, shop 3) and are locked and cannot be editied. To edit the values, the subform must come into play and here is what i lacks knowledge to continue: the subform is made of 2 fields - Subtract and Add field - so...




    _______ADD / SUB

    Shop 1 - ___ ___

    Shop 2 - ___ ___

    etc...

    ... the amount written down in the blank space (field) is automatically diminished or added to the locked-field of the 'stock' form

    Click image for larger version. 

Name:	67051405.jpg 
Views:	31 
Size:	65.5 KB 
ID:	6487

    What do i need to do in order that the written down amount is automatically calculated and set into the locked fields? Any database examples or any detailed help please would be greatly appreciated. Im a very beginner at acceess

    Thanks for your kind help
    Clara

  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
    Need to know more about data structure. Are you trying to maintain a 'stock balance' field in a table? Stock balance should be calculated from stock in and out transaction records. Provide detail on data structue and relationships or attach project for analysis.
    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
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26
    Hi, thanks for your reply - i have attached the exact database i am working on:

    http://speedy.sh/FCG9c/Database-Example.zip

    The form is named "stock dismissal". Inside, there is a search box; when i type in a code from the green drop-down menu, the system automatically finds the item and loads the information. In the red area (locked fields) are the stock amount of the product i listed. On the right is the subform: filled the necessary information, the user then must write a number in the fields of the blue box -

    search code number "KDS6783" for example. when now user types 5 in ADD box of SHOP 1, the locked field QTY SHOP 1 gets summed automatically and updated to "8"...

    search code number "HS121A" for example. when now user types -8 in SUBTRACT box of SHOP 1, the locked field QTY SHOP 1 gets summed automatically and updated to "14"...

    Hope i am explaining myself good... thanks for your time

  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
    You want entries in the Inventory subform to adjust the values of the 'red' boxes? In AfterUpdate event of textboxes, simply (modify expression as needed for each textbox event):
    Forms![stock dismissal].quantityshop1 = Forms![stock dismissal].quantityshop1 + Me.addshop1

    What should be done with the warehouse boxes?

    Suggestion: Eliminate the popup message 'Product Found'. Also, could use the AfterUpdate event of combobox to run the search code. That's two less button clicks to aggravate users.
    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
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26
    Quote Originally Posted by June7 View Post
    You want entries in the Inventory subform to adjust the values of the 'red' boxes? In AfterUpdate event of textboxes, simply (modify expression as needed for each textbox event):
    Forms![stock dismissal].quantityshop1 = Forms![stock dismissal].quantityshop1 + Me.addshop1

    What should be done with the warehouse boxes?

    Suggestion: Eliminate the popup message 'Product Found'. Also, could use the AfterUpdate event of combobox to run the search code. That's two less button clicks to aggravate users.
    Big thanks june7 for helping solving this out actually what i have to do with warehouse boxes is to repeat the code there again in case the user decides to change those data as well...

    Let me ask you another quick question - the code ends quantityshop1 + Me.addshop1. The "+" sign assigns a plus in the field and a "-" for subraction. But what if 1 field can both subtract or add? I mean like...

    .quantityshop1 + / - Me.addshop1 (synax is wrong however)

    Thanks for the suggestion, im working on that now

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You enter negative number as a negative, i.e. with the - sign. The equation is the same. A positive + negative results in subtraction.
    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.

  7. #7
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26
    Quote Originally Posted by June7 View Post
    You enter negative number as a negative, i.e. with the - sign. The equation is the same. A positive + negative results in subtraction.
    Problem now solved. Thank you so much june7, your knowledge was very appreciated

  8. #8
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26
    Hey june, I'm returning with some modification of the code you sent me. So this is the code:

    Forms![productscoderplus].quantity = Forms![productscoderplus].quantity + me.add

    This subform is named productscoderplus and is mainform 'inventory'. Can you enlighten me what am I doing wrong in the synax?

    Thanks

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    My example intended the code to be in the AfterUpdate event of textbox addshop1 which is on subform but the expression references control on the mainform and revises data in that control.

    You are showing an expression that refers to control on subform and not what I undestood you needed.
    Exactly where is the code you implemented and what data should be adjusted?
    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. Auto completing data entry forms
    By adamlukegilbert in forum Forms
    Replies: 1
    Last Post: 09-06-2011, 08:58 AM
  2. Stop auto save of forms
    By shanky365 in forum Forms
    Replies: 2
    Last Post: 07-28-2011, 08:37 AM
  3. Auto numbering of forms
    By bgeorge12 in forum Forms
    Replies: 5
    Last Post: 06-30-2011, 05:05 PM
  4. Auto fill-in text box on forms
    By windwardmi in forum Forms
    Replies: 7
    Last Post: 09-13-2010, 02:47 PM
  5. Auto Update Forms
    By Vikki in forum Forms
    Replies: 1
    Last Post: 02-09-2010, 10:51 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