[AccessD] Unbound Form Check For Changes

Bill Benson bensonforums at gmail.com
Sun Mar 23 20:06:44 CDT 2014


So what would the class be, of type Control? And.... why? The method I gave
returns that ANY change occurred, and it is simple. It doesn't care if a
control's old value equaled its new value, it cares if any combination of
values change... period. Which means that it doesn't worry about storing any
control's old value. It records the lot on form load, and tests it whenever
you want.

I see no benefit to class in this context unless you need more from the
class later.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John W Colby
Sent: Sunday, March 23, 2014 9:02 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Unbound Form Check For Changes

And having done all that stuff, I would go with a class.  All of the code to
check old value = new 
value, a dirty flag and so forth can be stored in the class.

John W. Colby

Reality is what refuses to go away
when you do not believe in it

On 3/23/2014 7:04 PM, Bill Benson wrote:
> Re: Dirty, even if bound, a change would mean the user began to edit the
> form, not that they necessarily "made" a change.
>
> As for storing the control values, if all you care about is testing if ANY
> controls changed, I would put a tag in every control where this is a
> possibility and loop through all controls, test for this tag - then you
> won't have to worry about labels and controls with no value throwing off a
> runtime error. I would just store all values in a single string using a
pipe
> separator, and check this again later.
>
> 'Warning air code!!!
> Option explicit
> Dim m_Initial_Control_Values as String
>
> Form_Load()
> For each ctrl in controls
>     If ctrl.tag = "ValidateMe" then
> 	m_Initial_Control_Values  = _
> 	m_Initial_Control_Values  &"|" & NZ(ctrl.value,"") &"|"
>      End If
> Next
> '...
> End Sub
>
> Have a function named FormChanged
>
> Function FormChanged() as Boolean
> Dim strValidate as string
> For each ctrl in controls
>     If ctrl.tag = "ValidateMe" then
> 	strValidate  = _
> 	strValidate &"|" & NZ(ctrl.value,"") &"|"
>      End If
> Next
>
> FormChanged = (strValidate <> m_Initial_Control_Values)
> End function
>


---
This email is free from viruses and malware because avast! Antivirus
protection is active.
http://www.avast.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list