473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to calculate Stock on hand using Stocktake as a base quarterly

547 512MB
I have database with the normal stock acquire and sales fields. My issue is the stocktake table that will be used to zero all the stock on hand quantities, when it is done quarterly. These values from the stocktake table will then be used as a SOH reference from the date that the count was done, for any additions or subtractions in the inventory there after.
My million dollar question:
Any suggestions on how to do the stock on hand calculation after the last stock take, without having previous stocktake figures affecting the outcome of the results?
I imagine that the vba code should check the last date and quantity when a stocktake was done per item (if an item was out of stock on that date, then the value should be "0"), and then use this quantity as a base before any additions or subtractions has to be done.

Tables:
stocktake table = tblstocktake
some of the fields:
stocktakeid
stocktakedate
productid
clientid
Quantity

tblClient
ClientId

tblProduct
ProductId

i have an idea one should use the dLast function
but include the client, stocktakedate and product
Expand|Select|Wrap|Line Numbers
  1. DLast("Quantity", "tblstocktake", "stocktakeid = ???  
Any suggestions will be welcome.
Jul 5 '13 #1

✓ answered by ADezii

It would appears as though something like this is in order:
Expand|Select|Wrap|Line Numbers
  1. DLast("[Quantity]", "tblStockTake", "[StockTakeID] = " & 841 & _
  2.       " AND [ClientID] = " & 999 & " AND [ProductID] = " & 41278 & _
  3.       " AND [StockTakeDate] = #" & "7/5/2013" & "#")
  4.  

2 1726
ADezii
8,834 Expert 8TB
It would appears as though something like this is in order:
Expand|Select|Wrap|Line Numbers
  1. DLast("[Quantity]", "tblStockTake", "[StockTakeID] = " & 841 & _
  2.       " AND [ClientID] = " & 999 & " AND [ProductID] = " & 41278 & _
  3.       " AND [StockTakeDate] = #" & "7/5/2013" & "#")
  4.  
Jul 5 '13 #2
neelsfer
547 512MB
thx adezi i will give it my best shot tomorrow and let u know.In addition to this i will have to filter all the sales and order transactions on and after the stocktake date to get to the final stock on hand total.

tblsales
salesid, salesdate,quantity

tblorder
orderid, orderdate,quantity
thx for your effort so far!
Jul 6 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

28
by: John Bailo | last post by:
Funny, how Bill Gate uses the Deutsches Bank and Barron's to defraud people and try to wreck his competitors ( he can't ). For example, ...
2
by: Mitch Mooney | last post by:
Subject line says it all. For example: //base class class foo{ public: foo(); ~foo(); virtual ??? GetValue()=0; };
1
by: Softari | last post by:
Why does program crash if object is deleted using base class pointer that is not the first base class? Please look exaple below. #include <iostream> class A { public:
2
by: Patrick Blackman | last post by:
I want to create my own custom common dialog derived from the base class"CommonDialog" to display my custom form any ideas how to accomplish this with an example. Thanks Patrick
2
by: UJ | last post by:
I have a base window I want to use to base all of my windows on (this has some timer functionality I need.) So I created the window winWindowBase and put the code in it. When I change the parent...
3
by: yan | last post by:
Hello everybody, I am new so this is the occasion to say hello to everybody. I have a problem with absolute/relative paths. I have to create a static documentation in html for a project and I have...
3
by: PamelaB | last post by:
I am trying to calculate the year end cost basis of equities held. I have downloaded all the transactions (purchases and sales) for the year and have them in a table. I need to calculate the value...
0
by: Steve Richter | last post by:
my composite control does not render correctly the 2nd time it is made visible. When I change the base class from CompositeControl to WebControl, the control works as it should. public class...
3
by: yuvalbra | last post by:
Does anyone know how to implement a stock quote using ASP on a website? Any sample code or components, etc., would be appreciated. I try this but got error 500 on page strURL =...
5
by: Rohullah | last post by:
Hello Sir I have Error with the following tables one is And one is. Income table Columns. Date ItemID ItemType Amount DriverName TruckNo --------------------- Stock Table...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.