PC Review


Reply
Thread Tools Rate Thread

Can I track edit chnges to Access Tbl., such as chnge font color?

 
 
=?Utf-8?B?cmJpcTQ=?=
Guest
Posts: n/a
 
      16th Feb 2006
I am editing and making several changes to a large data base. I would like
to have a font color change so I can readily see what has been changed as I
will be editing over several months. Any suggestions?
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      17th Feb 2006
To get the conditional formatting, you would need to create a form rather
than editing directly in the table, but that's easy and you can use a form
in Datatsheet view if you want it to look like a table. (To set Conditional
Formatting, open the form in design view, select the text box, and choose
Conditional Formatting on the Format menu.)

The more signicant isssue is that Access does not even track changes at the
record level, let alone at the field level. This means you will have to use
code to log the changes. There are several ways you could do this if you are
comfortable writing VBA code.

One solution would be to log the changes to another table, on a
field-by-field basis. There is a knowledgebase article explaining how to do
this at support.microsoft.com, but the problem with this approach is that it
will require a DLookup() for each field in its Conditional Formatting, and I
imagine performance would be unusable.

To avoid that, you could add another field to your table for every existing
field, to store whether it has changed or not. Performance would be much
better. This will work only if you have fewer than 127 fields in the table
(since 255 is the max number of fields.)

For example, if you have a field named City, you add a Date/Time field named
(say) CityChanged. You then use the AfterUpdate event of the City text box
to set the CityChanged to Now() unless its Value is the same as its
OldValue. You would also need to use the Undo event of the control to set
the value of CityChanged back to CityChanged.OldValue. And in the
Conditional Formatting, you would use:
Expression [CityChanged] Is Not Null
and choose the color you want. Repeat for every field in your form.

If you have fewer than 32 fields in your table, and are absolutely certain
that the table structure will not change (no new fields, no deleted fields,
no reordering of fields), you could get away with just one extra field of
size Long Integer, where each bit tracks whether the corresponding field
changed. The events would be similar to the City example above, but you will
be using binary And and Or operators to set/read/restore the bits in the
bitfield.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"rbiq4" <(E-Mail Removed)> wrote in message
news:47F4BAD2-5212-42CD-91E5-(E-Mail Removed)...
>I am editing and making several changes to a large data base. I would like
> to have a font color change so I can readily see what has been changed as
> I
> will be editing over several months. Any suggestions?



 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      17th Feb 2006
Here's a quick demo of the technique:
http://allenbrowne.com/unlinked/FieldChange2000.zip

It's an MDB for Access 2000 and later. Zipped. 15kb.

You have to set up the fields and text box properties as well, but it
contains just 7 lines of code:

Function SetFieldChange(frm As Form, ctl As Control, DateCtl As Control)
'Purpose: Record the date and time that a field changed.
'Usage: Set the AfterUpdate property of the control to something
like this:
' =SetFieldChange([Form], [City], [CityChanged])
'Arguments: frm = the form the control is on.
' ctl = the control that changed.
' DateCtl = the text box to set the date/time value when ctl
changes.
'Author: Allen Browne. (E-Mail Removed). February 2006.

'Don't mark new record as changes.
If Not frm.NewRecord Then
'If the control was changed back to what is was, change the date
control back too.
If (ctl = ctl.OldValue) Or (IsNull(ctl) And IsNull(ctl.OldValue))
Then
DateCtl = DateCtl.OldValue
Else
'If it was changed to anything else, record the date and time of
the change.
DateCtl = Now()
End If
End If
End Function

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Allen Browne" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> To get the conditional formatting, you would need to create a form rather
> than editing directly in the table, but that's easy and you can use a form
> in Datatsheet view if you want it to look like a table. (To set
> Conditional Formatting, open the form in design view, select the text box,
> and choose Conditional Formatting on the Format menu.)
>
> The more signicant isssue is that Access does not even track changes at
> the record level, let alone at the field level. This means you will have
> to use code to log the changes. There are several ways you could do this
> if you are comfortable writing VBA code.
>
> One solution would be to log the changes to another table, on a
> field-by-field basis. There is a knowledgebase article explaining how to
> do this at support.microsoft.com, but the problem with this approach is
> that it will require a DLookup() for each field in its Conditional
> Formatting, and I imagine performance would be unusable.
>
> To avoid that, you could add another field to your table for every
> existing field, to store whether it has changed or not. Performance would
> be much better. This will work only if you have fewer than 127 fields in
> the table (since 255 is the max number of fields.)
>
> For example, if you have a field named City, you add a Date/Time field
> named (say) CityChanged. You then use the AfterUpdate event of the City
> text box to set the CityChanged to Now() unless its Value is the same as
> its OldValue. You would also need to use the Undo event of the control to
> set the value of CityChanged back to CityChanged.OldValue. And in the
> Conditional Formatting, you would use:
> Expression [CityChanged] Is Not Null
> and choose the color you want. Repeat for every field in your form.
>
> If you have fewer than 32 fields in your table, and are absolutely certain
> that the table structure will not change (no new fields, no deleted
> fields, no reordering of fields), you could get away with just one extra
> field of size Long Integer, where each bit tracks whether the
> corresponding field changed. The events would be similar to the City
> example above, but you will be using binary And and Or operators to
> set/read/restore the bits in the bitfield.
>
> "rbiq4" <(E-Mail Removed)> wrote in message
> news:47F4BAD2-5212-42CD-91E5-(E-Mail Removed)...
>>I am editing and making several changes to a large data base. I would
>>like
>> to have a font color change so I can readily see what has been changed as
>> I
>> will be editing over several months. Any suggestions?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Track Changes Color Same for 2 Editors, Different for the 3rd Edit Rutabaga Microsoft Word Document Management 2 16th Oct 2008 09:51 PM
Changing font color in "Track changes" =?Utf-8?B?Z3JvdXBlcjM0?= Microsoft Word Document Management 1 24th Mar 2007 07:10 PM
how can I edit/change the font color in an excel formula? =?Utf-8?B?c3RyYW5kaWU=?= Microsoft Excel Misc 1 23rd Sep 2006 01:08 AM
Edit with a different font color? =?Utf-8?B?cGFua2Vzaw==?= Microsoft Word Document Management 1 29th Jan 2005 02:04 AM
Chnge the font and language in contacts? =?Utf-8?B?R2Vvcmdl?= Microsoft Outlook Contacts 0 27th Feb 2004 12:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:14 AM.