473,796 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to update order table

3 New Member
hi i'm trying to update total order cost in order table , basically what i want when i edit order item table such as changing quantity then it automatically update the total cost in order table

i mean if there are two order items in orderitemtable such as for item 1 and the hire cost is £20 and quantity is 2 for each item and these two different orderitems ID are under one orderID and it calculates the total order cost but doesnot shows in the order Table

als if i try to edit orderitem form such as changing quantity
it only change the total order cost on the order form but doesnot change the total order cost in order table
i think i did not explain properly so here is the coding

Dim strSQL As String
Dim strAddItem As String
Dim strOrderID As String

Call clearOrderItems List
decTotal = 0
strOrderID = txtOrderID.Valu e

strSQL = "SELECT tblOrderItem.* "
strSQL = strSQL & "FROM tblOrderItem "
strSQL = strSQL & "WHERE tblOrderItem.[OrderID] = " & "'" & strOrderID & "' ;"
'MsgBox strSQL

Set rstOrderItemDet ails = dbase.OpenRecor dset(strSQL, dbOpenDynaset)

strAddItem = "OrderItemI D" & ";" & "ToolID" & ";" & "HireDate" & ";" & "TotalCost"
lstOrderItems.A ddItem (strAddItem)
strAddItem = ""
While Not rstOrderItemDet ails.EOF

strAddItem = rstOrderItemDet ails("OrderItem ID") & ";" & rstOrderItemDet ails("ToolID") & ";" & rstOrderItemDet ails("HireDate" ) & ";" & rstOrderItemDet ails("TotalCost ")
decTotal = decTotal + Format((rstOrde rItemDetails("Q uantity") * rstOrderItemDet ails("HireCost" )), "0.00")
lstOrderItems.A ddItem (strAddItem)
rstOrderItemDet ails.MoveNext
Wend
txtTotalCost.Va lue = decTotal
rstOrderItemDet ails.Close
Call UpdateTotalCost
End Sub

please help very very urgent
thanks
Apr 22 '10 #1
1 1848
patjones
931 Recognized Expert Contributor
Based on the code that you posted, there is no reason to believe that the table itself would be updated. You are defining a SQL string and using it to pull data from the table and display it on the form. I don't see anything explicit here that would update the table.

However, at the bottom I see that you are calling another routine, UpdateTotalCost. I think that is what we need to look at. Can you post the code for it?

Pat
Apr 22 '10 #2

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

Similar topics

3
3272
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old scripts working on a new server with the most recent version of PHP. I've pretty much taken care of all the various errors that were popping up. Most only pointed out out non-fatal undefined or assumed variables. I've been able to cure most of...
5
3846
by: jayson_13 | last post by:
Hi, I need to implement a counter and i face problem of locking so hope that u guys can help me. I try to do test like this : 1st connection SELECT * FROM nextkey WHERE tblname = 'PLCN' FOR Update; (when i execute this statement and i guess that this will lock the
6
61585
by: Karen Middleton | last post by:
In MS Access I can do in one SQL statement a update if exists else a insert. Assuming my source staging table is called - SOURCE and my target table is called - DEST and both of them have the same structure as follows Keycolumns ========== Material
14
4301
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to salvage the records from the many table and without going into detail, one of the reasons I can't do the opposite as there are records in the ONE table that I need to keep even if they don't have any child records in the MANY table. Below I created...
2
2524
by: serge | last post by:
/* This is a long post. You can paste the whole message in the SQL Query Analyzer. I have a scenario where there are records with values pointing to wrong records and I need to fix them using an Update statement. I have a sample code to reproduce my problem. To simplify the scenario I am trying to use Order related tables to explain a little better the tables i have to work with.
3
5137
by: Greg Strong | last post by:
Hello All, Is the only solution to an update query which requires the records in a certain order to dump the records into a temp table in the required order, then do the update query? I've tried nesting a select query with the proper sort order inside the update query, but the update query still appears to complete in the order of the records in the table. I thought that I'd keep it a simple question without getting into the detail of...
1
6290
by: md7546 | last post by:
Hi, first time posting to this group, but I have followed advice and examples for several months, so thank you. I work for a small telecommunications company. I have a simple Orders database that has an Orders table to track a sales order, using OrdersID as the PK. I have a related one-to-many table called OrderDetails, with the OrdersID as a FK, which shows all the products sold with that order. Then I have an Update table, in a...
1
2467
by: teenagelcruise | last post by:
hi, i have a problem with my code which is i cannot update and addnew data into the database but i can delete the data.plz give me an idea.this is my code that i wrote. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Order Record</title> <meta name="Microsoft Border" content="tlb, default"> </head>
2
2885
osward
by: osward | last post by:
Hello there, I am using phpnuke 8.0 to build my website, knowing little on php programing. I am assembling a module for my member which is basically cut and paste existing code section of various module that I found it useful. Here is the 1st problem I encounter: I had a function to edit a event row form the database which is fine with me, than I pass on the code to a function that save(update) the data to the database.
5
6963
by: handoyo | last post by:
Hi all,i'm trying to show updated data in existing html td.. For example i got column that show last modified datetime,then i want to update data again,the column will changed to current time without refreshing the page.These are my codes views/order_home <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery.js"></script> <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery.form.js"></script> <script...
0
9531
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10187
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9055
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3735
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.