form datasheet conditional formating

  • Thread starter 2Stupid2ownAputer
  • Start date
2

2Stupid2ownAputer

Hello please help,
access 2k pro win xp
I have a form displayed in datasheet view for entering data
Datasheet view is necessary because what comes after may be depend on what
came before on several entries.
the first field is ID second FORENAME next comes SURNAME followed by other
fields.
ID is of the format 0000.00 where the integer part is the group and the
decimal part is the member within that group.
example:
0001.01 John Doe: husband - other fields.....
0001.02 Emma Doe: wife
0001.03 Thomas Doe: son
0001.04 Catherine Smith: daughter
0001.05 Samuel Smith: son-in-law
0002.01 Jack Brown: husband
0002.02 Mary Brown: wife
0002.03 ......
to make it easier to recognise family groups I wish to alternate INT(ID)
with different colours perhaps a pale blue or a pale yellow. I think I need
to create a function in a module (I already have a module with a function in
it-- can I use the same module?)
And I think my code would be something like:
if INT(ID) mod 2 = 0 then me.datasheetbackcolor= (long integer for Pale
Yellow)
else me.datasheetbackcolor= white
end if

else don't matter because I would just use default color

thank you in anticipation of your help
 
T

tina

well, i'm not sure how you could do it in the form's module, because the
code would 1) read only the value of the ID field in the *current* record,
and 2) setting the DatasheetBackColor would change the color of the entire
datasheet, not just one record.

try setting conditional formatting on each control in the form. in form
design view, click the first control to select it. then from the menu bar,
click Format | Conditional Formatting. in the dialog box's Condition 1
section, change the "Field Value Is" combo box selection to "Expression Is".
in the long textbox at the right, enter the following expression, as

Int([ID]) Mod 2=0

and select the backcolor from the Fill/Back Color tool button below the
textbox, and click OK. repeat this for each control that you want to change
the BackColor.

hth
 

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