Missing record field color change

L

llively2

I am new to Access and want to know if a text feild display in a
different color to show needed data is missing only when field is
empty. Also can it be made to flash to help call attention to the
field?

Thanks
 
S

Steve Schapel

Llively,

In design view of your form, select the text box, and then click on
Conditional Formatting from the Format menu.

In the Condition box, select 'Expression is', and then type the
equivalent of...
[NameOfYourField] Is Null
and then set the colour as required using the colour tools for forecolor
and backcolor.

To make it flash, this is another matter. This would require the use of
macro or VBA procedure, to run on the form's Timer event. This would be
ok if you are using a single view form, but will not work well if you
are using a continuous view form.
 
L

Larry G.

There are several ways to make sure that data gets put into a field.

The first is to set the field as "required" when you set up a table. One of
the best ways to make sure data gets entered into a field is to make that
field the primary key, the drawback to this is that the data must always be
unique.

The second way to do this is through the use of VBA code, if you are
unfamiliar with Access however, I would not attempt this unless you have
several hours to kill. My suggestion would be to create a data entry form,
then in field you want to make sure is not left Null to add code that OnExit
will verify that the field IsNull = False. You can add color to the field
also maybe make the backColor vbRed then OnExit if IsNull = False change the
BackColor back to white.

Please let me know if this helps you and also let me know if you need
additional help.

Larry
 
L

llively2

Thanks to Steve & Larry,

I do know some VBA code and where to insert it if you could layout the
syntax for me, it would help. I am updating a Non-profit organizations
WDB to an MDB to assist them. They use this database to input
information for the needy they serve. I have some other parts of the
Access program I need help with and will post later.

Thanks again,

Lynn
 
R

Ron2005

Conditional formatting is probably the easiest:

format of the expression is probably: isnull([fieldname])
(can also be written as: isnull([fieldname])=true )
then set the formating for when that is true.

The test can be anything you want for instance it could be:
[fieldname] = 0 (or [fieldname] = "abcde" )

Ron
 
S

Steve Schapel

Ron2005 said:
format of the expression is probably: isnull([fieldname])
(can also be written as: isnull([fieldname])=true )
then set the formating for when that is true.

Should be...
[FieldName] Is Null
 
S

Steve Schapel

Lynn,

I am not sure what you have tried of the previous suggestions, and what
you are now asking for. If you mean a VBA procedure, as suggested by
me, to make the control flash, please note the caution I gave regarding
not being suitable for a continuous view form. Something like this...
1. Set the form's Timer Interval property to 1000 (i.e. 1 second)
2. On the form's On Timer evetn property, enter code along these lines...
If IsNull(Me.NameOfControl) Then
If Me.NameOfControl.BackColor = 255 Then
Me.NameOfControl.BackColor = 16777215
Else
Me.NameOfControl.BackColor = 255
End If
End If
 
Y

yomzy32002

Hey, I have got a reminder's text box to show a colour if a contract is
due for example, i used conditional formatting, how can i get this
txtbox to flash rather than staying in the still colour?
Thanks is advance
 
S

Steve Schapel

Yomzy,

You would need to use code along the same concept of what I showed in my
earlier example. The specifics would depend on how you can assess
whether a contract is due, and what colours you want to use, etc.
 
Top