Hello All,
I have tired to calculate the quantity on hand using query as below, but someone told me this way works for small business and small number, it will slow down when you have a large amount of orders!, could you please advice better way?
and
best way to Calculate Qty on Hand in Database?
-
- BronzeLounger
- Posts: 1246
- Joined: 01 May 2016, 09:58
best way to Calculate Qty on Hand in Database?
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78568
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: best way to Calculate Qty on Hand in Database?
How many records do you expect? On modern PCs, Access is quite capable of calculating the stock on hand on the fly for thousands of records. It might become a problem if you have hundreds of thousands or millions of records.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1246
- Joined: 01 May 2016, 09:58
Re: best way to Calculate Qty on Hand in Database?
Thank you for the reply,
so you mean for a medium business that having 10K records 6 or less in a month will not have an issue they way i posted?
Regards
so you mean for a medium business that having 10K records 6 or less in a month will not have an issue they way i posted?
Regards
-
- Administrator
- Posts: 78568
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: best way to Calculate Qty on Hand in Database?
In my experience, they shouldn't have problems.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1246
- Joined: 01 May 2016, 09:58
Re: best way to Calculate Qty on Hand in Database?
Thank you very much
-
- 2StarLounger
- Posts: 113
- Joined: 22 Feb 2022, 09:04
Re: best way to Calculate Qty on Hand in Database?
I would expect large companies like Amazon, use the same method?
Perhaps ask your someone how he would do it, and keep the quantity on hand accurate all the time?
Perhaps ask your someone how he would do it, and keep the quantity on hand accurate all the time?
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.
-
- 4StarLounger
- Posts: 563
- Joined: 27 Jun 2021, 10:46
-
- BronzeLounger
- Posts: 1246
- Joined: 01 May 2016, 09:58
Re: best way to Calculate Qty on Hand in Database?
another approach suggested by a friend, is adding QtyOnHand to table ProductT, and use an update query to deduct number from QtyOnHand
but not sure how this method is more effective or not
but not sure how this method is more effective or not
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78568
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: best way to Calculate Qty on Hand in Database?
That method is often used if the number of records is expected to be very large. Storing the quantity on hand is more efficient than calculating it each time in that situation.
But there is a small risk that the stored quantity will become inaccurate over time, for example if a delivery or order is cancelled.
So if you do this, it is advisable to check the stock against the values stored in the database periodically, for example once or twice a year, and correct the values in the database if necessary.
But there is a small risk that the stored quantity will become inaccurate over time, for example if a delivery or order is cancelled.
So if you do this, it is advisable to check the stock against the values stored in the database periodically, for example once or twice a year, and correct the values in the database if necessary.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1246
- Joined: 01 May 2016, 09:58
Re: best way to Calculate Qty on Hand in Database?
can we add a button to put Quantity back to the Junction table PurchaseDetailsT ?
-
- Administrator
- Posts: 78568
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: best way to Calculate Qty on Hand in Database?
Sorry, I don't understand. From where would you want to place Quantity into PurchaseDetailT? And why?
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 113
- Joined: 22 Feb 2022, 09:04
Re: best way to Calculate Qty on Hand in Database?
Nor would I, but the logic would be the same?
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.
-
- BronzeLounger
- Posts: 1246
- Joined: 01 May 2016, 09:58
Re: best way to Calculate Qty on Hand in Database?
What I mean is when we an order, the quantity in the the PurchaseDetailsT table decrease, so in case one of the orders has been canceled for any reason we have to increase back the quantity in the PurchaseDetailsT table using a Cancel Order button and removed from the orderDetailsT table as well