Click to See Complete Forum and Search --> : Tracking changes in a recordset
lenin
Mar 16th, 2000, 05:58 PM
Hello,
does anyone have an idea how I could check for changes made to a form populated by the records from an SQL query. I had been using the datachanged property for each control in the controls collection of the form, but have just realised that datachanged only relates to databound columns.
Is there anything available, property wise, that would note changes in the recordset say, as opoosed to the form?
Any suggestions greatly appreciated.
Thanks
Tony.
Elias
Mar 16th, 2000, 11:28 PM
Text boxes have a change method that invokes when typing occures. You may use this way to insure changes are made to the recordset as any changes occur. Now, the database will not be permantly changed until the rstMain.update method is invoked.
Example:
Private Sub Text1_Change()
rstMain!fieldname = Text1.Text
End Sub
Now, only the local recordset is changed, but the database remains unchanged until the .update method is invoked.
Note: There are certain locking and open settings that need to be set on the recordset for this to work. I think these are the settings: adLockOptimistic and adOpenDynamic
-Elias
Edited by Elias on 03-17-2000 at 12:30 PM
lenin
Mar 19th, 2000, 04:20 PM
I had already had a look at this solution but I have a lot of text boxes, and hoped to:
1. Bind each text box to the relevant field in a recordset.
2. When attempting to perform an action check if the data in the control has changed by using datachanged property, whcih according to MS documentation says:
"When a data control moves from record to record, it passes data from fields in the current record to controls bound to the specific field or the entire record. As data is displayed in the bound controls, the DataChanged property is set to False. If the user or any other operation changes the value in the bound control, the DataChanged property is set to True. Simply moving to another record doesn't affect the DataChanged property."
When I check for datachanged, if nothing has changed it continually returns true.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.