How tell if value of any control has changed ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a tabbed control with around 7 tabs each with multiple controls. All controls are unbound and updates are done manually via command buttons.
Is there any easy way to tell if the contents of any control have changed other than having a hidden value for every control and doing a compariuson of before/after??

The problem is I have a print command button which prints from the underlying table and I need to know whether I need do a save before the print.
 
My guess would be to save the record anyway (DoCmd.acSaveRecord) before
the print. You might want to examine isDirty, but I'm not sure that
will do the job for you. Good Luck
 
I think you're seeing the down-side of using an unbound form in Access.
While it can be done, you lose a lot of Access's built-in features.
You can't examine the Dirty property, because that applies to the built-in
recordset.
You can't just do a SaveRecord, because nothing is bound.

Here are a couple of scraps of what may be good news, though.
1. You don't seem to need a "hidden value" for each control; you can just
have a form-level boolean variable.
Set it to True in the AfterUpdate event of each control which holds value
(yes, unbound forms require a lot more explicit programming) and False in
your Save routine.
2. Today's processors are very fast. Chances are nobody will ever notice
the few milliseconds it takes to go ahead and do your save anyhow.

HTH
- Turtle

david said:
I have a tabbed control with around 7 tabs each with multiple controls.
All controls are unbound and updates are done manually via command buttons.
Is there any easy way to tell if the contents of any control have changed
other than having a hidden value for every control and doing a compariuson
of before/after???
The problem is I have a print command button which prints from the
underlying table and I need to know whether I need do a save before the
print.
 
Thanks for the tips

Yes unbound forms are a LOT of work, a LOT more than I imagined
My problem now is that when a save is done certain validations take place, so if I just do a save when they print it may write an invalid record. If I run the full update routine it does all kinds of stuff I dont really need to do, like disabling buttons etc. etc.
 
Sounds as if you need to revisit your application design, to make sure that
your functionality is segmented into enough separate procedures that you can
get the ones you need to run when you need them, and only when you need
them.

Of course if you're considering redesigning your application, there's always
the option of using a bound form after all... <g>

HTH
- Turtle

David said:
Thanks for the tips.

Yes unbound forms are a LOT of work, a LOT more than I imagined.
My problem now is that when a save is done certain validations take place,
so if I just do a save when they print it may write an invalid record. If I
run the full update routine it does all kinds of stuff I dont really need to
do, like disabling buttons etc. etc.
 
Back
Top