Dirty record on unbound form

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

Guest

How do I check if a record is dirty on an unbound form with unbound controls?

Thanks,
Melanie
 
You don't.

The unbound form has no Dirty property, and the unbound controls have no
OldValue, and so Undo is without meaning.

You could use the AfterUpdate event of every control to set your own
module-level variable to indicate if there has been a change anywhere, but
you are not going to arrive at the functionality of a bound form.
 
I beleive you'd have to take care of that yourself.
Perhaps you could have a boolean module level variable that you would toggle:
a) when the vaue of any control on the form changes
b) after you have saved your values
 
According to The VB Help:"You can use the Dirty property to determine whether
the current record has been modified since it was last saved..."

I don't think a form can be Dirty if it isn't bound to the data it is
displaying.

- Marvin
 
You will need your own dirty property. Create a form level variable. You
will also need your own Cancel routine (for the form, the Esc key will work
for a dirty control) in which you would set this variable back to False. You
would also reset it after saving the changes.

If you decide to create your own cancel routine for the form, the OldValue
property (and some others) of the control doesn't work when the control is
unbound. You will need to use the control's Change event to compare the
control's Value property to it's Text property.
 
Are there any resources on the Internet to assist me with the VBA coding of
this solution? I can't seem to find much help on error checking for unbound
forms.

Melanie
 
I tried looking in my usual places and didn't see anything, but may have
missed something. There are probably examples that do this, I just didn't
find any that were listed as being specifically for unbound forms.
 
You've got to be kidding!

Answer not shown.
"Sign up to see this solution"
Popup ads.

Is this response for a spammer or a bot?
 
I did kind of hesitate on that reply. Actually, though, the answers are on
the page (scrolling down past the "Sign Up to See This Solution" - at least
in my browser they are). I didn't know there were pop-ups because I have them
blocked. I hope I didn't offend. I don't really get the logic behind their
site.

However, I have gotten a lot of good help from allenbrowne.com.

Again, I appologize if that was a bad link.

Thanks.
 
Back
Top