Inventory Query Calculations
Jan 21, 2007
Within my "Products" form, I have a "Transactions" subform whose records are
categorized in five different type of inventory transactions - let's say "A", "B", "C", "D", and "E".
I'm using linked queries (instead of DSum) to calculate the net inventory amount (A+B+C-D-E) per product - sort of a running total.
The problem is that transaction type "E" may not appear for a particular record!
Consequently, the query calculations omit those products without transaction
type "E".
How can I include all the "Products" records into my inventory query calculations even though a product may not contain all the transaction types in their records?
Thanks, in advance, for responding.
Tony:confused:
View Replies
ADVERTISEMENT
Sep 28, 2015
I have solved the problems getting values on the subform. I have not in getting values on the subform.For instance, on the one titled phone use the formula in the tutorial is:
=[sbfCustomerRoomUse].[Form]![txtTotalPhoneUse]
#Error results when the doc is put into a form mode.
Now when I input each value in the equation above separately.I still get no entry.
For " = sbfCustomerRoomUse" , I get #Error;
and for "= txtTotalPhoneUse", I get #Name.
CustomerRoomUse and txtTotalPhoneuse are from the subform that was dropped into the customer form in a previous step. It shows that explicitly when designed sbfCustomerRoomUse on the main that CustomerRoomUse come from a subform. This does not seem to need to be done with txtTotalPhoneuse, and I am not sure why. Neither one gives me a desired calculation result.
View 14 Replies
View Related
Mar 9, 2006
I have an inventory table with the following feilds
InventoryTransactionID
ProductID
UnitsReceived
UnitsSold
UnitsShrinkage
I would like to create a query to give me an inventory for each product that i can reference to in a UnitsInStock control in a Product form.
I have tried the following with no success. What am i doing wrong?
UnitsInStock : =Sum(nz([UnitsReceived])-nz([UnitsShrinkage])-nz([UnitsSold]))
I get this error "You tried to execute a query that does not include the specified expression <name> as part of an aggregate function." (Error 3122)
Thanks for any help you can give me.
View 1 Replies
View Related
Jul 18, 2014
I've created a database of equipment we keep in a vault. Every so often the boss wants a count of items by model. I would like to create a button on the switchboard that can bring up this count for him.
First I have created a query which will count by model. The SQL of that query is here:
SELECT Count(*) AS Expr1
FROM [Count Query]
WHERE ((([County Query].[Model]) Like "nnn"));
(nnn is the model number I will want and will have a diff query for each model.) Now, I'm trying to get these into a form for the boss to simply click. When I do, I get the #Name? error. What am I doing wrong here?
View 3 Replies
View Related
Sep 7, 2005
Hi, firstly I just want to put I'm a beginner in SQL so don't laugh too loud when you read this.
I have a query that takes two field sfrom seperate tables. Lets call the fields X and Y.
The X field contains an ID number (there are 6 possible instances) which can be duplicated many times. The Y field holds individual pieces of data(sample data below)
........X....................................Y
......1202..............................ABCDE
......1202..............................FJDUS
......1202..............................HFDYH
......1402..............................JHFJGF
......1402..............................GHDDF
......1506..............................FVHJFG
......1609..............................JHFHGF
......1609..............................JJVVJHV
......1609..............................BJHHGG
......1609..............................VJXGGJ
......1609..............................VJXGJKH
I need to be able to find out how many instances of Y occur for each ID number in the X field so the query would show something like
..........X.............................Total
.......1202..............................3
.......1402..............................2
.......1506..............................1
.......1609..............................5
Once you have stopped laughing can you please let me know what criteria I need to put in to carry this out, thanks
View 1 Replies
View Related
Aug 8, 2007
Thanks mainly to John K I have the following code from a previous post which identifies when a 'Unit' has been entered at 2 different 'JettyNumber' on the same 'StartDate'
SELECT Qry_All_Ops.StartDate, Qry_All_Ops.Unit, Count(Qry_All_Ops.Unit) AS CountOfUnit, Sum(Qry_All_Ops.JettyNumber) AS SumOfJettyNumber, [SumOfJettyNumber]/[CountOfUnit] AS Result, [result]=CInt([result]) AS Expr1
FROM Qry_All_Ops
WHERE (((Qry_All_Ops.Operation)<>"Boat Transfer" And (Qry_All_Ops.Operation)<>"Diving"))
GROUP BY Qry_All_Ops.StartDate, Qry_All_Ops.Unit, Qry_All_Ops.Status
HAVING (((Count(Qry_All_Ops.Unit))>1) AND ((Qry_All_Ops.Status)="approved") AND ((Sum([Qry_All_Ops].[JettyNumber])/Count([Qry_All_Ops].[Unit])=CInt(Sum([Qry_All_Ops].[JettyNumber])/Count([Qry_All_Ops].[Unit])))=0));
Unfortunately the maths bit of it highlighted below...[SumOfJettyNumber]/[CountOfUnit] ...is not cleaver enough to find all of the occasions where a Unit has been put in the wrong place.
I think I need to use CountOfUnit x JettyNumber <> SumOfJetty. If that equation is TRUE then there is a conflict, if FALSE then there isn't.
I think I can get this to work if I can get [JettyNumber] into the same query that I already have [CountOfUnit] & [SumOfJetty].
Any clues please ?
View 1 Replies
View Related
Mar 25, 2008
Hope someone can help.
I have 3 tables. Table 1 contains Opening Balance (item ref is unique key). Table 2 contains qty in and Table 3 contains qty out (relationship between all 3 tables is via item ref which is only unique in Table 1).
I am trying to make a query to show the current balance and have tried the following:
Current stock: Nz([Opening Balance])+Nz([qty In])-Nz([Qty Out]) but this is not working.
I think its the link between the 3 tables. If I only put items from table 1 in my query it shows up, but the moment I add table 2 and/or 3 nothing happens.
Anybody any idea where I'm going wrong?
Thanks
Christine
View 7 Replies
View Related
Feb 14, 2013
I want to perform a calculation that returns a value that is the difference between current month and previous month.I have a data base for trucks, mileage, hours etc.
So the calculation will be on the Mileage feild. I know how to write and expression to perform a calculation between one field and another, but, is it possible to get calculate the differnce between values using the same feild. I.E
Month January February
Mileage 109000 101000
View 4 Replies
View Related
Apr 24, 2015
I am using access to gather data about individual products. I use this data to estimate manufacturing times for production planning. There are 85 different times and each is calculated in a different way. To calculate the times I pull from various tables.
My final query has the following headers:
Model, Category, Code, Time
Model: is the product
Category: is the department that the process occurs in
Code is the: individual step that occurs in the process
Time: is the time that the step takes
Right now I have five separate categories and I have split the process up into five separate querys
DFM_SA (25 process steps = 25 individual querys unioned together)
DFM_HA (2 process steps = 2 individual querys unioned together)
DFM_GA (22 process steps = 22 individual querys unioned together)
DFM_WE (10 process steps = 10 individual querys unioned together)
DFM_FI (26 process steps = 26 individual querys unioned together)
I will then combine the five querys using a Master query for a specific model. I will then dump the resulting data into a table so that I am not constantly rerunning this massive query. I use a delete and append query to update the table, but only for the specific model.
The query runs okay, but not as fast as I would like (which is to be expected due to the size). If I run this query while I have some other tables open I get the alarm that Access cannot open more databases. I imagine this is because of how massive the query is. I am only accessing four databases, but I am guessing that each query that I have unioned together is accessing each database separately and perhaps it is overloading the system.
Is there a way I could utilize a macro or some other method for streamlining this process? I am concerned about the stability of the way I am currently doing this.
Example of one of my querys
SELECT ITEMS_RAWMAT.MODEL, "WE" AS AREA, "WESGSAMT" AS CODE, Sum([QTY]*[WESGSAMT]) AS [TIME]
FROM (ITEMS INNER JOIN ITEMS_RAWMAT ON ITEMS.ID = ITEMS_RAWMAT.[RAW MATERIAL]) INNER JOIN [P/N Times Table] ON ITEMS_RAWMAT.MODEL = [P/N Times Table].[PART NUMBER]
GROUP BY ITEMS_RAWMAT.MODEL, "WE", "WESGSAMT", ITEMS.CATEGORY
[Code] .....
View 3 Replies
View Related
Dec 8, 2014
I'm receiving an error indicating there is a data type mismatch when running a query named qappInventoryTakeOn.
Data is entered into the Inventory Transaction Form. If the transaction type is "Take On", when the update button is clicked the record will be saved to tblInventoryMovements and then qappInventoryTakeOn should run to update tblInventory, but I keep running into the aforementioned error.
View 2 Replies
View Related
Aug 7, 2015
I have a Inventory DB and i want to integrate scanning. So far i have a table called StockInfo, this table holds information about bar codes (device type, make, model). I have a form called Scan_Barcode, on this form I want to be able to scan a bar code into a text box (text0) and use a afterupdate and requery function to display the results onto a form called EnterInventory.
Not only just the results but I want certain columns from the query to display in certain text boxes on this form. I have a query called FindProduct. that filters the criteria by whats entered on the Scan_Barcode text box (text0). So when i scan a certain bar code i can get the query to display certain product information for the bar code. I just cant get the results onto the HarwareStock form.
View 8 Replies
View Related
Jun 4, 2007
I have 2 calculations in a single query.
1st - ProdCost: [TBLinvqty]*67
2nd - Gross: [TBLinvamt]-[ProdCost]-[TBLfrtamt]-[TBLocamt]
The query runs and works fine but it keeps prompting me for ProdCost but if I hit ok it runs fine.
How do I get it to quit prompting me for Prodcost
BTW, Prodcost is not a field in a table its only the 1st calculation in this query
View 8 Replies
View Related
May 20, 2013
I need to do a calculation on the RESULTS of a query. Each record in the table I'm querying has a date stamp. I have a query that produces a list of the newest records for each machine. I want to calculate how old each of those records is based on today's date.
So far when I try to include the calculation in that query, it returns all the records instead of the newest ones. This makes me think I'm doing something fundamentally incorrect. The calculation is affecting the query results where I just want to do the calculation on the results. What I'm trying to ultimately do is have a way for the users to see a list of machines that are overdue for a certain procedure. I was thinking of putting a button on a form that will run the query and present the list, perhaps with some conditional formatting highlighting the machines that are overdue, etc. Do I need to just use 2 queries?
View 14 Replies
View Related
Nov 7, 2014
I've been trying unsuccessfully for weeks to try and query a usable data set that would later be used for calculated values in a report.
I'm building a Hospital Acquired Infections Database for my facility to record data and process reports automatically. Previously, I built the system in Excel using VBA and userforms, but the size of the file has become too cumbersome, and now takes too long to process my reports.
So here's the issue.
UNIT_DATA TABLE:
UNIT
INF_MONTH
INF_YEAR
PT_DAYS
CVC_DAYS
IUC_DAYS
VENT_DAYS
APV_DAYS
PT_LEVEL TABLE (There are many fields in this table for recording purposes but I will only list the ones I need for reporting purposes):
UNIT
INF_STE_MAJ
SPECIF_SITE
INF_MONTH
INF_YEAR
So the important numbers I can't seem to collect are the total number infections per month from the PT_LEVEL Table for only select SPECIF_SITE infections.
the Tables are joined Left to Right as Follows:
UNIT_DATA.UNIT - PT_LEVEL.UNIT
UNIT_DATA.INF_MONTH - PT_LEVEL.INF_MONTH
UNIT_DATA.INF_YEAR - PT_LEVEL.INF_YEAR
The UNIT_DATA Table is a monthly collection for the 5 metrics (PT_DAYS, CVC_DAYS, IUC_DAYS, VENT_DAYS, APV_DAYS) regardless of whether or not the number for each is zero. Every unit in the database will have a record for each month and year.
The PT_LEVEL Table will only have records if and when a patient develops an infection. This means there is no cumulative monthly data for the PT_LEVEL Table Data based on SPECIF_SITE infection type.
I need to first do a roll up count for every month and year in the database, for which I was initially trying to use the UNIT_DATA table for since it contains every month and year. The problem is when I try to query the SPECIF_SITE from PT_LEVEL, I can get the number of Infections for months where infections where present for each unit and null values, for each month, and each year in UNIT_DATA, but when I include a where condition to narrow the view to only selected SPECIF_SITE's it only shows data for that SPECIF_SITE for months where they occured.
I need a cummulative monthly aggregation of the totals for a selection of SPECIF_SITE infections, for every unit, for every month, and every year, since July 2010.
View 14 Replies
View Related
Feb 12, 2014
I am designing a database in Access 2010 to handle customer discounts. The problem I am facing is that the discount can vary by customer. One could be a straight percentage based on certain sales totals, even the percentages can vary by customer, and some customer discounts are tiered. I was hoping there was a way to handle all through one query, because there are so many variations, it would require several queries if I separate by each calculation available.
Is there a way to set up a table listing the customer and their corresponding calculation expression then running a query using that table and the sales data table to do all the calculations. Or is there another way to handle this level of complexity in Access? The end result I would like is one data set with each customer and their calculated discount.
View 1 Replies
View Related
Dec 18, 2014
All I'm after is, to sum in all records "where" reconcileDate (on the sub=form) = today in both the credit and debit fields and minus one from the other. I have a simple form and sub-form. On the sub-form I have a query based calculation that returns the following..."if ReconcileDate (on sub-form) = today, then show Debit value in yndebit" textbox..Likewise with the credit box, and all works perfectly fine.
However, I can't seem to sum these two boxes. Because the circled textboxes are query based, I've used the query as the control source (and not the text boxes) and all I get is an #ERROR? when placed in the form footer. I've tried to do this using the textboxes as the control source, and still nothing. I've tried to add a calculated control on the form itself, and still #ERROR? or #NAME? despite knowing exactly how to reference subforms within forms (this I've become quite an expert at as I simply use query design to make sure I have the correct path and control)anyway.
View 13 Replies
View Related
Apr 5, 2013
I am trying to keep records of GST transactions.
I have a problem in figuring out how to do calculations in a query.
How to have the calculation in the attached MDB and Document for field #105_SubTotal and the field #115_PaymentEnclosed.
View 7 Replies
View Related
Jun 8, 2005
I have an odd problem that has stumped me for several days. I'm working on a form that contains a chart. The chart is based on a query, which is based on another query, which is based on a table. In the top query, I need to put some calculated fields that operate on other fields. But when I try to multiply two fields together, I get Null. I'm pretty confident that the fields I'm operating on are numerical.
The fields of the query should be:
MaxOfEverInSchool
MaxOfSurvivalToGrade
MaxOfEverInSchool
With these being the calculated fields:
MaxOfSurvivalToGradeCum: MaxOfEverInSchool*MaxOfSurvivalToGrade/100
MaxOfCanReadCum: MaxOfEverInSchool*MaxOfSurvivalToGrade*MaxOfCanRea dCum/10000
Any insight would be greatly appreciated--I just can't understand why Access would suddenly refuse to do math.
View 1 Replies
View Related
Feb 18, 2014
I am trying to add calculations to queries based on columns in the query... it seems to randomly expect 'Expression' or 'Group by' as column types, and Im having to create 3 sets of queries following on from each other to de-dupe data and allow filters on calculated values.
Also I've got a function which turns a date into a quarterly cohort, e.g. Oct 2013 -> 20134. I use ot on a lot of dates. I created a VBA function, CohortQ used as follows in queries:
Cohort: IIf Year([InputDate]) < 1990 or Year([InputDate]) > 2020, 0 CohortQ([InputDate]))
In the VBA, InputDate is defined as a date
Code:
Function CohortQ(InputDate As Date) As Integer
If InputDate = 0 Then
CohortQ = 0
Exit Function
End If
[Code] .....
But when I run it on a date field, it gives me a data mismatch error. I can't step through as it's working on 600K rows.
If I put the function into the query,
Cohort: IIf Year([InputDate]) < 1990 or Year([InputDate]) > 2020, 0 Year([InputDate])*10+DatePart("q",[InputDate]))
it works.
View 3 Replies
View Related
Jun 4, 2006
I'm curious, I need to set a database up to keep track of inventory for a new product. the product requires several materials to build the product. I would like to "forecast" so to speak, the amount of materials needed to maintain enough materials on hand for "x amount of product. Is this something I would use MS access for? Or would this be a better project for excel ? Any help would be appreciated.
If in fact ms access would work, could someone point me in the direction of an Inventory database tutorial?
View 1 Replies
View Related
Jul 7, 2006
I've been working on a new project, an Inventory DB..... Everything works well... BUT....... Now I am back to a design issue so I can deal with a FIFO inventory. I have searched the forum and every place else to try to see the prefered method for setting this up..... Can't find much. I have seen using serial numbers, or dates. Neither would work well for what I am looking at. I have thought of using a ID field for Inventory purchased.... Auto number... This would then show the first items in as the lowest number.
But........ What is the common method for setting this up? Any examples around?
Thanks
View 3 Replies
View Related
Jul 11, 2006
Could someone PLEASE point me in the right direction.... I've designed a couple of DB,s to handle inventory. But I am still stuck on bringing one option in. FIFO! My design for the FIFO will probable end up with the "purchases" table being set up with an "autonumber" field to record each purchase. My problem is still seeing some code to get the sale of items to loop thru these purchase "batches". If anyone knows of an example of this PLEASE post a link for me.
Thanks
Curtis
View 1 Replies
View Related
Mar 24, 2008
dear all
ı would like to calculate moving weighted avarage cost for inventory application
how to calculate method for query or report
please support
thanks
View 2 Replies
View Related
Mar 6, 2006
Hello this is my first post :)
well im making a Inventory DB and having a little trouble with adding and subtracting the units. This is what i need:
This is the command button
Private Sub Finish_PO_Click()
On Error GoTo Err_Finish_PO_Click
DoCmd.GoToRecord , , acNewRec
Exit_Finish_PO_Click:
Exit Sub
Err_Finish_PO_Click:
MsgBox Err.Description
Resume Exit_Finish_PO_Click
End Sub
I need to subtract this.....
Private Sub Units_In_Stock_BeforeUpdate(Cancel As Integer)
End Sub
From.....
Private Sub Units_Needed_BeforeUpdate(Cancel As Integer)
End Sub
Keep in mind i am a bit of a beginner but im a fast learner. Can anyone please help me with this
View 3 Replies
View Related
Jan 25, 2008
I made a seach on the internet and on the forum but I confused...
Till Monday I should have ready I DB regarding the inventory of the warehouse in the company. Till now they were using the Filemaker v.3 that it's not the most appropriate way. So I started creating a db where I have to show:
what get out and what get in,
the dates, and the person took them, and the place that the person went them,
and of course the quantities
but the inventory either gets bigger either smaller, and i have to fix it...
with what receipt no and type the items get out or in
and if we it as a sample
What I have done till now:
Products tbl product number (as listed on the computer), product number (according to the supplier), model number, supplier id, constructor id, description, comptible with (sometimes more than one product), price per item, qnty in stock, minimum stock, comments.
Customers tbl customer id, address, post code, phone number, city id
Cities city id, city
Suppliers supplier id, supplier, address, post code, phone number, city id
Constructors constructor id, constructor
The problem is how I add or subtract things from the products table?
View 14 Replies
View Related
Nov 8, 2006
Hi all.
I have been working on an Inventory Database over the past few weeks and I have run into a problem.
Currently I am designing the database to use the common way to calculate on-hand inventory levels (Latest Stocktake(cycle count) + Received - Used). The problem comes when I am trying to calculate this value.
A solution that seems to work is to take stocktake for a given product using the ProductID and date. I have a child table linked to this one to show the quantity and locations of the product. However, with this method, I will have to count the inventory for every location the product is in when the stocktake is taken. This method may work, but accidents may happen and an employee may forget to count both locations when taking stock. Then current inventory levels will be way off.
Is there an easier or more efficient way to do this?
Table Design
-=-=-=-=-=-=-
tblStockTake
StockTakeID
ProductID
Date
tblStockTakeDetails
StockTakeDetailsID
StockTakeID
Quantity
Location
View 2 Replies
View Related