Access - units on hand error

G

Guest

I am fairly new to access and am using the Inventory Control template. I have
put in the information for the 500 items we have and it calculates perfectly
when something is sold against what is in stock. However, when I go into
datasheet view the units on hand is all #error. In order to get the units on
hand I need to click on the + and then it shows. I can see it correctly in
form view but it would take forever to go thru each record that way and make
changes. Help please!

There must be an easy answer (I hope) for this!!

Thanks!
 
G

Guest

The Units in Hand and Units on Order figures are computed in the form by
reference to text box controls in the subform's footer which aggregate the
values from the column in its underlying Inventory Transactions table . As
the subform is in datasheet view you don't see these control in the subform,
only this in the parent form which reference them.

When you switch the form to datasheet view the two Units in hand and Units
on Order columns can no longer 'see' the subform, so can't compute the values
until you open the subdatasheet.

You can if you wish produce a summary of the products current stock
positions with a query such as that below; just paste it into a new query in
SQL view:

SELECT ProductName, ProductDescription,
ReorderLevel, LeadTime,
(SELECT
NZ(SUM(UnitsReceived),0) -
NZ(SUM(UnitsSold),0) -
NZ(SUM(UnitsShrinkage),0)
FROM [Inventory Transactions]
WHERE ProductID =
ProductID)
AS [Units In Hand],
(SELECT
NZ(SUM(UnitsOrdered),0) -
NZ(SUM(UnitsReceived),0)
FROM [Inventory Transactions]
WHERE ProductID =
ProductID)
AS [Units On Order]
FROM Products
ORDER BY ProductName;

In the query the two subqueries replicate the two computed controls on the
products form. You could if you wish create a new form, in datasheet or
continuous form view, based on this query and amend the switchboard form
(using the built in switchboard manager) so you can open it. You won't be
able to change the data in this query, however, as it includes aggregated
values. You can only change these by changing the data in the underlying
tables from which the values are computed, which you can do either in the
Products form and its subform, or by switching it to datasheet view and
opening the subdatsheets.

If you want to change the data in datasheet view then you can join the two
tables in a query such as this:

SELECT ProductName, ProductDescription,
TransactionDate, PurchaseOrderID,
TransactionDescription, [Inventory Transactions].UnitPrice,
UnitsOrdered, UnitsReceived, UnitsSold, UnitsShrinkage
FROM Products INNER JOIN [Inventory Transactions]
ON [Inventory Transactions].ProductID = Products.ProductID
ORDER BY ProductName, TransactionDate;

This will return multiple rows per product, one per inventory transaction
per product, rather than one row per product as with the first query showing
the summary aggregated data.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top