By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,460 Members | 2,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,460 IT Pros & Developers. It's quick & easy.

Conditional Formatting in Forms in A97

P: n/a
Hello everyone! I'm building a form in Access 97 and I want to to
show a special icon if the record has been marked as deleted.
Obviously, I don't want the icon to show if the record was not marked
as deleted. I understand the conditional formatting is available in
Access 2000 for this purpose, but it is not in 97. Is there a way to
emulate this effect through code? Thanks for any input on this
matter.

Alan
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I assume you have a checkbox or something like that to flag the recorded
as deleted (called say, chkDeleted) ?

Put an extra label control with a caption of 'Deleted', formatted as you
wish (Size,Colour etc) called say, lblDeleted.

When your checkbox or whatever is updated use the AfterUpdate event
procedure to make the label Visible or Invisible.

To get to the event procedure, right click the control and display
Properties, then show Event Properties. Click into the AfterUpdate event
property. On the dropdown list choose 'Event Procedure' then click the
build button (...) to the right of the event proerty box.

if me.chkDeleted = true then
me.lblDeleted.visible = true
else
me.lblDeleted.visible = false
end if

You will also need to put the same code into the On Current event
procedure for the form.
Regards

Peter Russell


Andante.in.Blue previously wrote:
Hello everyone! I'm building a form in Access 97 and I want to to
show a special icon if the record has been marked as deleted.
Obviously, I don't want the icon to show if the record was not marked
as deleted. I understand the conditional formatting is available in
Access 2000 for this purpose, but it is not in 97. Is there a way to
emulate this effect through code? Thanks for any input on this
matter.

Alan


Nov 12 '05 #2

P: n/a
Thanks for the reply Peter, but I had forgotten to mention that my
form is in continuous mode, so using that bit of code would cause all
the visible records to display the same icon. If I have 5 records
showing, and I move into a "deleted" record, the "deleted icon" will
show up on all 5 records regardless of whether or not the other 4
records were "deleted".

I did stumble across a possible solution shortly after I posted though
(don't you just hate it when that happens?):
http://www.mvps.org/access/forms/frm0024.htm
This provides an alternative to conditional formatting that allows you
to customize text displays depending on a stored or queried boolean
value (i.e. a yes / no field).

This should solve my original problem, but I have an alternative
question then: what if I want the current record to be highlighted
with a rectangle around the border?

Here is the rationale of why I want this -- the continuous form that I
mentioned has buttons at the header that perform operations based on
the current record. But when I manipulate the controls in the header,
the current record loses focus, and it becomes difficult to see which
record you are about to affect. I would like the current record to
remain "highlighted" even when it has lost focus. I wanted to do this
by setting the rectangle's visible proper via the onGotFocus and
onLostFocus events, but changing the rectangle's properties has a
global effect on all such rectangles on each record. Is there anyway
to get around this?

Sorry about my lack of foresight and my long post. Thanks for any
input on this.

Alan

pr******@russellscott.co.uk (Peter Russell) wrote in message news:<me***********************@russellscott.btint ernet.com>...
I assume you have a checkbox or something like that to flag the recorded
as deleted (called say, chkDeleted) ?

Put an extra label control with a caption of 'Deleted', formatted as you
wish (Size,Colour etc) called say, lblDeleted.

When your checkbox or whatever is updated use the AfterUpdate event
procedure to make the label Visible or Invisible.

To get to the event procedure, right click the control and display
Properties, then show Event Properties. Click into the AfterUpdate event
property. On the dropdown list choose 'Event Procedure' then click the
build button (...) to the right of the event proerty box.

if me.chkDeleted = true then
me.lblDeleted.visible = true
else
me.lblDeleted.visible = false
end if

You will also need to put the same code into the On Current event
procedure for the form.
Regards

Peter Russell

Nov 12 '05 #3

P: n/a
Andante.in.Blue previously wrote:
This should solve my original problem, but I have an alternative
question then: what if I want the current record to be highlighted
with a rectangle around the border?


You can use a similar technique, putting a rectangle behind all the
controls and setting the colour.

The best place for solutions to this type of problem is here:

www.lebans.com

There are demo files for 'conditional formatting' simulation for A97.

Regards
Peter Russell
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.