Checking for changed textboxes

J

John

Hi

I need to check which textbox controls on a form have their value changed. I
am using the below code to achieve this.

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If (IsNull(ctl.OldValue) And Not IsNull(ctl.Value)) Or
(IsNull(ctl.Value) And Not IsNull(ctl.OldValue)) Then

End If
End If
Next ctl

Problem is I am getting a "The expression you entered has a field, control,
or property name that Events 2006 can't find" error on the line;

If (IsNull(ctl.OldValue) And Not IsNull(ctl.Value)) Or
(IsNull(ctl.Value) And Not IsNull(ctl.OldValue)) Then

What is the problem and how can I fix it?

Thanks

Regards
 
A

Allen Browne

Examples:

a) An unbound control doesn't have an OldValue.

b) A control bound to an expression, or to a field that is read-only doesn't
have an OldValue.

c) A control bound to a non-existent field (e.g. if you changed the
RecordSource of the form so that the field is no longer present) doesn't
have a Value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top