Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Your Suggestions can be helpful regarding this

Status
Not open for further replies.

gerry03

Technical User
May 7, 2003
13
IN
Hi

I need your suggestions for updating an existing record after editing. I do the same by doing this:-

before updation I delete the whole record from both of my tables (Orders & OrderDetail) and then I save edited one.
I would like to know is this the right way to do this and secondly if yes, can this type of updation slow down the app's performance while the tables contains thousands of records.
I am newbie to VB

Thanks.
 
Why do you think the records should be first deleted?

I am asking because of the reference to the OrderDetails table.
So, are you cancelling an order completely and creating a new one, or adding ordered items to the order list, or changing a quantity, or what?

Are you using ADO or DAO?


 
Dear CCLINT

Edited record may have:

New lines/items added
some lines/items deleted

I am using ADO, here is how I do :

Textboxe values transfered to ListView and when 'CmdUpdate'
is clicked values are posted to Order & OrderDetail tables from ListView control.
Hence OrderDetail Table may contain multiple line for a record. Hope this will help u to understand.

Thanks
 
You definitely do not need to delete a record and add a new one if all you are doing is amend the details.

Your input form should update your table automatically.

My impression, for what it is worth, is that if the structure of your database is right you do not need Vb.

Now, as a self-taught programmer I have lost count of the hours (days even) which I have spent trying to work things out for myself and barking up a whole avenue of wrong trees.

Access, with its VBA, is capable of doing virtually anything. But sometimes it can be like trying to knit treacle!

My suggestion is that you take a good look and the structure of your Tables, Queries and Forms, making sure that they all link correctly. If you can't see anything wrong, or you are not sure how they should be working, make a plan of your entire database, showing links and joins and post it here.

If, in doing that, you end up solving your own problem, so much the better - I've done that too!

I (and I am sure a number of others) will watch out for it. So please, if you do solve the problem, post that too.


HenriM

 
So what you are saying is that you have:

- A list showing previously ordered items.
Which allows the user to:
1. Edit the previously ordered items
2. Delete previously ordered items
3. Add items to the order list.

Correct?

If so, then why are they allowed to edit, add to, or delete an order to simply?

Better would be to force them to cancel a complete order, and wait for confirmation that the can can be cancelled if not already processed and possibly on it's way to the destination.

If this is a prepared order, but not yet processed, then it would be better to changed the records in the table after each record is changed/added/deleted.

Another way would be to use a hidden column to identify that a record was edited, deleted or added in this session (EditStatus using an integer), and then when the user clicks to update, you loop through the records, check the EditStatus, and use an action action query to do whatever is needed (UDATE SomeTable...WHERE..., INSERT INTO SomeTable..., or DELETE * FROM SomeTable WHERE...)

But, if this isn't a prepared/temporary orders function, and the order was already placed, then probably the logic you are using is incorrect.

 
Dear CCLINT
The nature of order transaction is as given below:
We are basically a manufacturing house. so a customer can place an order for DIFFERENT items. we keep that order(s) in one record. Suppose he placed order for 5 items, we prepare for these items and as soon as the item(s) get ready we change the items status from PLACED to READY and if some of them has been delivered (quite possible) We change READY to DELIVERED so if items are delivered, it depend on us whether we want to delete the order/items or not.Hope this will help to understand the EDITING process.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top