Re: how to get both old and new value for a changed text box
- From: "Izzy" <israel.richner@xxxxxxxxx>
- Date: 30 Sep 2006 15:57:05 -0700
Also, does setting IsDirty
as you suggested prevent the automatic database update until you force
it?
What automatic update? Are you talking about the dataview accepting
changes and eliminating the old value. If so...No it wouldn't
Setting up a boolean "IsDirty" property would simply let you know an
update needs to happen, data has been changed in some way. I'm sure
your doing something similar to this now? right?
How are you currently telling your application that changes to data
have happened and now an update is necessary?
Izzy
Kathy wrote:
Izzy,
The Access app I am porting from is in use at multiple businesses where
there is a mix of databases sizes; some use Access and some use SQL
Server as backend db (hence my need to accommodate both). My users
require saving unlimited field change history (w/ old & new values, who
made the change, date/time change made, field changed, etc), so the
history can get rather large. I would prefer to capture the changes at
the same time a record gets saved versus as each field changes for
synchronization purposes. Just curious, why do you recommend against
comparing against the cached (old) values? Also, does setting IsDirty
as you suggested prevent the automatic database update until you force
it? Another contributor suggested saving the old value in each
control's Tag property. That seems workable, too. Another contributor
suggested subclassing, but I would lose the control's visibility in the
designer which I really don't want to do.
Thanks for the help.
Kathy
Izzy wrote:
Kathy,
I had a nice long respone written for you....then my stupid computer
over heated and turned off.
Anyway...here's an idea:
If this data is being stored in Access, you could insert the old data
into the history table before you run your update. This will create a
little extra duty for your database server but a very common task for
audit tracking.
I would try to avoid comparing each textbox's value with a cached
initial value too determine if changes have been made. I usually just
define a boolean property called "IsDirty" and on validating of the
textbox controls set this property to true. You can then use that to
determine if an update and insert needs to take place.
If IsDirty Then
MoveToHistory(PrimaryKey)
UpdateTable(PrimaryKey)
IsDirty = False
Else
'No Changes Detected
End If
Just curious...How big is this Access database? AND how much history do
you need too store?
Izzy
.
- References:
- Prev by Date: Text File Manipulation
- Next by Date: Re: Think BEFORE you post.
- Previous by thread: Re: how to get both old and new value for a changed text box
- Next by thread: Re: how to get both old and new value for a changed text box
- Index(es):