473,395 Members | 1,694 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.

Update Quanity on Hand

14
Hi,

I am creating an inventory management database.
I have three tables in this database, Products, Orders and Order Details.

I have a form Order Entry in which i create an order to be shipped to a client.
This form is created using a query that combines all fields of Orders and Order Details table.

The upper part of the order entry form is used to enter basic information such as the order date, client name, address etc.

The lower part of the Order entry form contains a subform (datasheet), where i enter order details.

There are two columns in the order entry subform

products and quantity

the product column actually allows you to select the product from a drop-down list (containing all products) and the quantiy column enables you to enter the total quantity of product shipped to the client.

there is also an Update Inventory button on order entry form.

Now, all i need to do is that after i finish selecting the products and specifying the quantity i would like to ship, I want to click the Update Inventory button, to deduct all the quantities of the products i selected from the Products table.

for example,

i selected D123 as product, and 12 as quantity,

clicking the update button should lookup the product table, search D123, and substract the quantity that is there.

I could have done this if i selected one product, but in the subform, i can select mutiple products. is there a way i can loop throught the products selected, and then deduct quantities.
Nov 26 '07 #1
1 2176
MMcCarthy
14,534 Expert Mod 8TB
Put the update code in the after update event of the quantity table. However, this is dangerous as if the user changes the quantity you have a problem.

The reality is this is the reason why a calculated field should not be stored. The correct way of handling inventory is to have a tblProductReceived showing a new record for each product recieved and its quantity and tblProductSold showing a new record for each product sold and its quantity.
A query then written based on these two tables should show quantity on hand at all times.
Nov 27 '07 #2

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

Similar topics

14
by: John | last post by:
Hi all, I am doing the change from having worked in Oracle for a long time to MS SQL server and am frustrated with a couple of simple SQL stmt's. Or at least they have always been easy. The...
2
by: meyvn77 | last post by:
I'm new to adp w/ sql server but I have to use it on a project i'm doing... One of the MUSTS for this project is the ability to update a 00 - 09 text value with the appropriate text description...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
5
by: Janick Bernet | last post by:
The following Update fails with SQL0407N on Colum "Name", although the source-table t_Addresses_2005 is defined with NOT NULL on that column: UPDATE Addresses.t_Paddresses Old SET (Name,...
1
by: Kunal | last post by:
Hi, I need some help on writing an update query to update "UnitsSold" field in Products Table whenever I save a transaction. The transaction may contain several "Subtransactions", one for each...
9
by: Mahesh S | last post by:
Hi I have to perform an update on a table. I am having problems figuring out how to join two tables as I need to check a value in a different table before performing the update. I have two...
4
by: BiffMaGriff | last post by:
Hello, I have a GridView that I put inside an update panel. I have a control that attaches to the datasource of the gridview that filters the data, databinds the gridview and then updates the...
7
by: HSXWillH | last post by:
I am designing an inventory system and am stuck on a potential problem. I have a table of Stock_Catalog containing the following fields: Stock_ID (random autonumber), Full_Desc, Serial, Auto,...
6
by: aBheE | last post by:
i am trying to implement an application in order to keep rercords of the stationary of a company. i have a combo box named ComboP_Name In FormProducts form,which is getting the values from the...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.