Need control to not display its data under certain circumstances

V

vegathena

I have a form that saves "99" for a particular field if that field is
left blank (which for us means that we tried, but weren't able to
collect that information).

However, when I load that form for a pre-existing record, I would like
these fields to not show the 99, but rather to appear empty. Is there
a way to do that through the control properties? Meaning, is there a
way to not display the saved value for a particular control if the
data saved for it was a 99?

Thanks for your help.
 
D

Dale Fye

Try conditional formatting.

Create a condition that says, if the value of the control = 99, then set the
forground color to the same as the background, make them both gray or white
or something.

That way:
1. the data is still there
2. you can see and edit the value, in case you determine the appropriate
value
at a later date

HTH
Dale
 
F

fredg

I have a form that saves "99" for a particular field if that field is
left blank (which for us means that we tried, but weren't able to
collect that information).

However, when I load that form for a pre-existing record, I would like
these fields to not show the 99, but rather to appear empty. Is there
a way to do that through the control properties? Meaning, is there a
way to not display the saved value for a particular control if the
data saved for it was a 99?

Thanks for your help.

You could use an unbound control.
Set it's control source to:
=IIf([SomeControl]=99,Null,[SomeControl])
 
K

Klatuu

The difficulty here is if you make the fore color the same as the back color,
and the user tried to enter a new value, they would not see anything. If you
use fredg's idea, it would not be an editable control.

You might try Dale's idea. I would have to test it to see if you started
typing in a new value whether the fore color would change.
 
K

Klatuu

Okay, I got it. Use Dale's method of setting the conditional formatting on
the control
Then so the user can enter values and see them, you need to change the value
of the control from 99 so what the user types in will show as he types it.
In my original test, the user can't see what he typed until he leaves the
field. So here is code for the got focus and lost focus events that will
make it work correctly.

Private Sub Text8_GotFocus()
If Me.Text8 = 99 Then
Me.Text8.Tag = "99"
Me.Text8 = Null
End If
End Sub

Private Sub Text8_LostFocus()
If IsNull(Me.Text8) And Me.Text8.Tag = "99" Then
Me.Text8 = 99
Me.Tag = Null
End If
End Sub
 
L

Linq Adams via AccessMonster.com

How about using a second condition in the Conditional Formatting, where the
condition is "Field has focus" and the colors are set back to the default so
that you can see data being entered?

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
L

Linq Adams via AccessMonster.com

Meant to add, would the second condition trump the first? Don't have access
to Access (sorry!) right now.

Linq said:
How about using a second condition in the Conditional Formatting, where the
condition is "Field has focus" and the colors are set back to the default so
that you can see data being entered?

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
K

Klatuu

Well, that would be worth testing, but if I understand the OP, he want the
user not to see the value 99 in the control. If you used that condition, the
value would appear. That assumes the two conditions would not interfer with
each other. It is interesting enough I will test it later today.
 
V

vegathena

Thanks for your help!

Well, that would be worth testing, but if I understand the OP, he want the
user not to see the value 99 in the control. If you used that condition, the
value would appear. That assumes the two conditions would not interfer with
each other. It is interesting enough I will test it later today.
 
D

Dale Fye

The conditional formatting is based on the sequence of the condition, so if
your first condition is "Has Focus" and the 2nd condition( = 99) then when
you tab into the control, you will see the values, but when it doesn't have
the focus, you will only see the grey box.

Dale
 

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