Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 52
  1. #31
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    hi and thanks alcapps for the idea, abit of background the database itself: i purchase goods from 3 suppliers, the quantity is stored in the products table. for example if i purchased 10 items on the 2 feb 2013 and only sold 8 to customers i have 2 remaining, hence the next purchase will 8 and not 10. so i have done what alcapps was mentioned above by adding another query.



    Click image for larger version. 

Name:	1.jpg 
Views:	12 
Size:	82.9 KB 
ID:	11042

    (qtyonhand+qtyPurchased)-qtySold

    This gives me

    Click image for larger version. 

Name:	2.png 
Views:	11 
Size:	17.7 KB 
ID:	11043


    is there a reason why gum bubblem and gomets do not have a number in the stock? is it because i did not purchase any from the supplier??
    i have a report that reads\is based on the products table, this shows the amount in stock (at hand)

    Ill try (and error) the next bit (i understand its not advised) that is to use an update query to write the new results from the query above into the products table. This is so the next purchase order and quantity at hand can be added and then subtracted from the amount sold.

    I dont understand why and how "There is a chance the UPDATE action could be accidentally repeated or forgotten" what if i run this query once the stock report is ran, it will only update once?

    many thanks to all

  2. #32
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Nothing is foolproof. If you rely on user to push 'Update Stock' button, what if they forget to push at all or get distracted and push it twice? The queries I suggested are to calculate the stock level at any time. Not advised to be used for updating table.
    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. #33
    alcapps is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    292
    I agree with june7 calculations is the way to go unless you are doing a history table at the end of a business day routine.

  4. #34
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    sorry i should have mentioned this before hand, its done at the end of the end, so 99% the end user will only click it once. iv looked online on how to update the stock row to the product table, any ideas or links your know of? iv tried to put in the update to field [product].[quantity] but access is giving me an error message.

    thanks

  5. #35
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What is 'end of the end'?

    I still think if you really want to do this then the stock adjustment should be done at the time each transaction is entered, not with an aggregate query.
    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.

  6. #36
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    sorry i meant at the end of the day, i was thinking to finish off the update query, then if it doesnt work well try the way you mentioned, to do it the way you are saying once a sale or a purchased is recorded,

    Click image for larger version. 

Name:	1.png 
Views:	10 
Size:	110.2 KB 
ID:	11051

    where or how do i update the stock? will the user by clicking a button or after a field is updated (Quantity) the value is updated (plus if purchased and minus if sold) in the products table?

    thanks
    Last edited by tweety; 02-05-2013 at 05:57 AM.

  7. #37
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    Has anyone got any links on how to store query results to a table, I have checked on Google but didn't find anythink, this is this site i found http://office.microsoft.com/en-gb/ac...76527.aspx#BM4

    after trying this, access gives this error message

    Click image for larger version. 

Name:	1.jpg 
Views:	13 
Size:	94.0 KB 
ID:	11050
    Thanks

  8. #38
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    In some event (button click or textbox AfterUpdate or form BeforeUpdate) maybe like:

    CurrentDb.Execute "UPDATE Products SET Quantity = Quantity - " & Me.QtySold & " WHERE ProductID = " & Me.ProductID

    or

    CurrentDb.Execute "UPDATE Products SET Quantity = Quantity + " & Me.QtyPurchased & " WHERE ProductID = " & Me.ProductID

    However, before you commit to this approach please read http://www.allenbrowne.com/AppInventory.html
    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.

  9. #39
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    I really dont know what to say? THANKS! with the above commands the stock is updating. at first i put the code into "after update" but this did not work as the default quantity is set to 1, so i moved it over to "on Exit" seems to work fine after testing both sales and purchase orders.

    Currently there is validation in place so the product table show quantity as minus. Saying this before joined the forum i looked alot on the net for stock control and i did come accros allen brownes link, i would have throught there would be many samples of stock but anyway

    Thanks again to all

  10. #40
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    is there a way to validate the stock e.g if the stock is =0 then a message is displayed while a product is sold

    the way this system is setup is, items are sold durning the day and in the evening i sit on the computer and record sales made to find out the profit, so there is never a change i sell a product which is out of stock

  11. #41
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Did you mean 'chance' instead of 'change'?

    Yes, can do a DLookup for the current balance on hand.

    How can you sell something that is not on the shelf? If you don't enter sale at time of purchase how can you know the actual quantity available for the next buyer?
    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.

  12. #42
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    yes sorry
    can you guide me in using the dlookup please
    the way this works is i load my car up with current stock, but more for the suplliers if needs be, then go around to the shops and sell. at the ned of the day i come back home, enter the purchase orders and then go through the sales bit (of the system) sellecting each customer and putting in their items. a notes is made while items are purchased and sold

  13. #43
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Access Help (or Google search) has guidelines on domain aggregate functions (DLookup, DSum, DAvg, etc).

    Can be used in expression in query or textbox or VBA.

    Post your attempt for analysis if have issue.
    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.

  14. #44
    tweety is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2012
    Posts
    126
    Sorry I forgot to attach the system
    Attached Files Attached Files

  15. #45
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Don't see any attempt at using DLookup in VBA. Have you tried it somewhere else? Review Access Help on use these functions. Attempt code. Post code 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.

Page 3 of 4 FirstFirst 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Stock Inventory Design
    By plowe in forum Database Design
    Replies: 3
    Last Post: 09-06-2012, 05:47 PM
  2. Inventory stock levels
    By Sagrado in forum Access
    Replies: 1
    Last Post: 03-15-2012, 10:20 PM
  3. Calculating Current Stock in Inventory/Warehouse
    By yohansetiawan in forum Access
    Replies: 5
    Last Post: 03-14-2012, 09:05 PM
  4. Invoicing with Stock Control Design ....
    By mond007 in forum Access
    Replies: 5
    Last Post: 05-23-2010, 07:21 AM
  5. creating a stock control database!!! HELP!!!!
    By Legend9 in forum Database Design
    Replies: 1
    Last Post: 09-10-2009, 02:24 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