473,426 Members | 1,851 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,426 software developers and data experts.

how to Update Stocks when used?

Hi All,

I am asked to build a database for a Printing Company that would prepare a Job quote for the Customers and review the stocks available to carry out the Job.

Stock Information performs the following:
1. Enter stocks information
2. update Stocks. say, when Eyelets stock is 20 and if we get another 5 eyelets today, then it should update the total eyelets to 20
3. Inform user when stocks runs out.

Quote information does the following:
1. enter the information and estimate the prize.
2. if stocks runs out to carry out the job, it should prompt the user.
Say for example, if the company has 20 Eyelets stock and it needs 25 eyelets for the current job to be done, while preparing the quote, the system , after estimating the prize, must tell the user that tstock runs out.
3. when the job is confirmed, it should then update the available stocks.
Say the company has 10 eyelts, and job needs 5 eyelets. once the job is confirmed, it should recduce the total available eyelets stocks to 5.


I need your help to perform this operation. As of now i am having a table for Stock,and Quote. i need someone to give me an idea of what i should do step-by-step.

This is very urgent and i want this to be done ASAP.

Need someone to guide

regards,
Kathy
Sep 5 '07 #1
1 1277
barry07
47
Very briefly - you need a function which will be called by some event (button click or whatever) on the user form, which checks stock and allocates it if sufficient is available. I'm assuming a table called stock which contains a PartNo field (text) and a stock quantity field called "available_stock" (numeric - single)


Expand|Select|Wrap|Line Numbers
  1. Function CheckStock (quoteQty as single, sPart as string)
  2. stockqty= dlookup("available_qty", "stock", "PartNo='" & sPart &"'")
  3. if stockqty< quoteQty then
  4.    Msgbox "Insufficient stock - only " & stockqty & " available", vbcritical
  5. else
  6.    Msgbox "Stock OK" ' this part is optional
  7.    DoCmd.RunSQL "Update stock set available_qty=available_qty-" & quoteQty & " where Partno='" & sPart & "'" 'this line reduces the available stock
  8. End if
  9. End Function
Do you have a table that records what stock has been allocated against what quote? Might be a good idea in case you have to reallocate.

Hope this helps
Sep 5 '07 #2

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

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
0
by: Kate Stahl | last post by:
--_E4.3.C_FED..A. Content-Type: text/plain; Content-Transfer-Encoding: quoted-printable Investor Insights Newsletter features companies with revolutionary product= s and soaring revenues. We...
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...
8
by: Sean Shanny | last post by:
To all, The facts: PostgreSQL 7.4.0 running on BSD 5.1 on Dell 2650 with 4GB RAM, 5 SCSI drives in hardware RAID 0 configuration. Database size with indexes is currently 122GB. Schema for...
4
by: philippe | last post by:
Hello, I'm wondering how developpers dealing with Stocks software, manage to allow user to visualize 'stock datas' when moving mouse over a 'barchart' or a 'average line' ??? Is it possible...
20
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've...
11
by: diablo | last post by:
Hi i need help with formulating a query that will update the a field on one table depending on the values from another for example i have a cart table: cartid, buyerid, productid, quantity ...
2
by: kathnicole | last post by:
Hi i have a table called tblStock consisting of Avaialble Stock for our company. i need to update the Stocks whenever we receive new goods. I have another table called tblStockInfo about received...
3
by: Michel Esber | last post by:
Hi all, DB2 V8 LUW FP 15 There is a table T (ID varchar (24), ABC timestamp). ID is PK. Our application needs to frequently update T with a new value for ABC. update T set ABC=? where ID...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.