473,405 Members | 2,185 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,405 software developers and data experts.

Changing or editing

Hello All,

Im struggling to get this idea and work out how to go about solving this issue.

What i want to happen is when a item is ordered and quantity selected, it is placed into a listbox, this quantity is removed from the item table. Then if the item is edited, for example if a total of 2 is selected first then it is edited to say 4, what i want it do to is remove another two from the order table. Or the other way if quantity of 4 is selected and it is changed to 1, then i want it to add 3 back on.

Im really stuck on this, any help would be appreciated
Mar 14 '08 #1
6 1114
janders468
112 Expert 100+
I am not sure how your table is structured, but given what you are doing I would assume that you have a master item table of some sort that lists the items you have and then another column that shows how many are in stock (an inventory on hand column perhaps) and an order table that shows the items ordered and the quantity. If this is the case then all you need to do is run a query that subtracts the quantity ordered in the orders table from the quantity on hand in the items table. You could have this query run every time an addition or deletion is made, and simply put in some logic that controls for things like ordering more items than are in stock. So this is how I am viewing it.

Items
Item Quantity

OrderedItems
[Items Ordered] [Quantity Ordered]

The query would then be
Expand|Select|Wrap|Line Numbers
  1. UPDATE Items 
  2. INNER JOIN OrderedItems ON [Items].Item=[OrderedItems].[Items Ordered] 
  3. SET Items.Quantity = [Items].Quantity-[OrderedItems].[Quantity Ordered];
  4.  
If the amount ordered is adjusted down you could do the exact same thing only change the query to add Items back instead of subtract, or you could utilize the same query by interpreting putting items back as ordering negative amounts. For instance if initially a quantity of 4 is selected and then the quantity is decreased by 2 it would be interpreted as ordering -2 items which would put 2 items back into the inventory on hand column.
Hopefully that helps if it's off the mark let me have a little more detail and I'll see what I can come up with.
Mar 15 '08 #2
i have an Items Table - which contains item details and stock levels
Itemhire table - item ordered, stock (from the items table) and quantity (this is the amount which the client selects)

Ive had a look and tried working with what you have produced but it still does not like it.

Would you have a sample of this?

All this help is much appreciated... Thanks
Mar 16 '08 #3
im still having issues with the information provided, would you have an example of this
Mar 20 '08 #4
janders468
112 Expert 100+
I'll try to work up an example on this, sorry I didn't get back sooner I didn't see that you had replied.
Mar 20 '08 #5
Thanks

That would be much appreciated!!!!
Mar 21 '08 #6
janders468
112 Expert 100+
I was re-reading this post and realized I might have over-answered your question. What part were you having trouble with initially? If you have a control that holds the number of items ordered then a query can adjust the inventory to the inventory - quantity ordered. Are you having trouble with figuring out how to work that into a query? I apologize it has taken me so long between posts I've been very busy, but if you are still having a problem let me know.
Mar 25 '08 #7

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

Similar topics

7
by: kah | last post by:
How do I change a line in a file?? For example I have the follwing text in my file: line1 line2 line3 line4 How do I replace 'line2' with 'newline'. Since the write operation in
2
by: ehm | last post by:
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic...
3
by: MS | last post by:
What's the best way to "store" and display a value in a text box that changes from day to day. An example of this would be where the name of the user is manually typed in after using the datbase,...
4
by: Jim M | last post by:
Two questions: 1) I have a scheduling application (Access 2002) that allows multiple staff members to edit notes on their meetings and appointments from their offices. A receptionist views a...
32
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's...
5
by: Rob Roberts | last post by:
Is there any way to change VS2005 to generate HTML 4.01/Strict instead of XHTML 1.0/Transititional? VS2005 puts a DOCTYPE statement specifying XHTML 1.0/Transitional at the top of every new aspx...
10
by: 7stud | last post by:
Hi, I'm experimenting with a basic socket program(from a book), and both the client and server programs are on my computer. In both programs, I call socket.gethostname(), but I discovered that...
1
by: peck2000 | last post by:
Related to my earleir post ... this is the same project to re-purpose the Classifieds application in BEGINNING ASP 3.0 (Wrox) to a comicbook database ... This is a brainteaser that should have...
6
by: kdd21 | last post by:
Hi, Just got my first service written in VB-- works fine but the event log was showing the start stop entries as Service1 so I went in to change it, but changing the servicename properties in...
6
by: John | last post by:
Hi I have a winform db app that is "bound" to a dataset...via data adpater, binding source and all that. As this is a multi-user app I need to refill dataset from time to time so the newest data...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...
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,...

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.