|
-
Dec 14th, 2001, 05:54 AM
#1
Thread Starter
Hyperactive Member
edit records
Hi
i have a small application for payroll.
While editing and saving records, first i delete the record to be updated and then add new one as edited one. But i think this is not a good logic.
How can i update only those records which are changed. How can i keep the track of textboxes or comboboxes which are changed?
Thanks in advance
-
Dec 14th, 2001, 06:03 AM
#2
r u using ADO to access data? I persume u r using Ms Access to store data. what's the structure of the table u r updating?
-
Dec 14th, 2001, 06:06 AM
#3
Well ...
You can edit a record by using the .Edit method in DAO. In ADO it is not required.
When you display a record, you already are at the desired record. While saving the information, now, you can use the .Edit method to put the recordset in edit mode, assign new values to the fields, and then .Update the recordset.
Also I use a global variable Changed which is a boolean to verify if any data was changed or not. In all the Change events of the textboxes, I set this variable to True. At the time of saving, I run the save code only if Changed is True.
Also if you are using a grid to display multiple records at the same time and allowing the user to edit more than one record at a time, you may create another column in the grid which is hidden, and contains Yes/No based on whether the user changed a particular row or not. And then when saving, go through the recordset checking each record, and using the hidden column you can find out if the record was changed or not.
.
-
Dec 14th, 2001, 06:23 AM
#4
Thread Starter
Hyperactive Member
well the structure is simple like one master and one detail table for one form and database is access.
I will try method suggested by honeybee and let you know
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|