Link to home
Start Free TrialLog in
Avatar of peispud
peispudFlag for Canada

asked on

Access 2010 Conditional fields

Hi.

I am using Access 2010

I would like to use conditional formatting to change the colour  of a row if it is locked.
Since I am using this rule over several columns,  I would prefer if the syntax  in the conditional statement were to refer to it's own "self" column instead of by column's name.

For example.

[Field1].Locked=True         ... this works fine but I would  prefer to have the syntax read something like

col().locked = true      so I can use the same code over multiple columns.

Hope you can help.
Avatar of Michael Carrillo
Michael Carrillo
Flag of United States of America image

I am not sure I understand what you are trying to do.
But, could you use a function?

Something Like:

function funLock( col_name as string, bolVal as boolean) as string
dim retVal as string
dim strVal as string

if bolVal = 1 then strVal="True"
else
strVal="False"
endif

retVal=col_name & ".locked = " & strVal

return retVal

Or worst case you could create a function that locks and unlocks a series of columns.
Avatar of peispud

ASKER

I apologize.

This is what I asked but it was not a good question....  

I would like to use conditional formatting to change the colour  of a row if it is locked.

I should have asked

I would like to use conditional formatting to change the colour  of a column if it is locked.
ASKER CERTIFIED SOLUTION
Avatar of Michael Carrillo
Michael Carrillo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rey Obrero (Capricorn1)
you  can use VBA to handle this, see this link
http://msdn.microsoft.com/en-us/library/aa139965%28v=office.10%29.aspx
Avatar of peispud

ASKER

Thank you.