Conditional Formatting Expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hopefully a quick and easy question here...

I've got a number of fields in a form I would like to format based on values
in a different field. Lets say that each field in my form is a process and
the value of the field is a sequence number that tells what order the fields
will be processed in. In separate hidden fields (editable by double clicking
the object field) is a value of either 1, 2, 3 or null (1 for Process
Pending, 2 for Process Running or 3 for Process Complete).

Lets take my RawStock field for example. Stock cutting is generally the
first process to a job, so the value of this field is usually going to be 1.
What I would like to do is change the StockStatus (1,2 or 3 for Pending,
Running or Closed), and change the backcolor of the RawStock field based on
the value in the StockStatus field rather than the RawStock field.

I believe this can be done using the Expression portion of Conditional
Formatting, but I am really not very good with expression syntax. Ive tried
Me.StockStatus=1 or Me.StockStatus.Value=1 for expressions for formatting but
can't seem to get results. Any help in this matter would be greatly
appreciated. For more details on what I'm working with and how I came about
this problem see my post a few threads down titled "Cont. Form Backcolor by
Record" Thanks again to missinglinq, I've almost got this doing exactly what
I want it to do.

Thanks in advance,
Jack
 
Jack,

Set the Conditional Formatting fields for the RawStock field to
'Expression Is' and the second field to '[StockStatus] = 1' (without
the single quotes but you do need the square brackets). When the
expression evaluates to True (i.e. when StockStatus = 1) the
conditional formatting will be active. Use the Add >> button to add
further tests for the same field (you can only have 3 altogether).

Note also, that if you want something more complicated, you can create
a Function in VBA code, store it in a Module and then call that from
the Conditional Formatting form (although this shouldn't be necessary
for what you need).

HTH

Peter Hibbs.
 
Thanks Peter, that seemed to do the trick. I figured I had the syntax wrong
for the expression I was looking for. I had thought of a function for that,
though I had wanted to stay away from most code for this particular project.

Peter Hibbs said:
Jack,

Set the Conditional Formatting fields for the RawStock field to
'Expression Is' and the second field to '[StockStatus] = 1' (without
the single quotes but you do need the square brackets). When the
expression evaluates to True (i.e. when StockStatus = 1) the
conditional formatting will be active. Use the Add >> button to add
further tests for the same field (you can only have 3 altogether).

Note also, that if you want something more complicated, you can create
a Function in VBA code, store it in a Module and then call that from
the Conditional Formatting form (although this shouldn't be necessary
for what you need).

HTH

Peter Hibbs.


Hopefully a quick and easy question here...

I've got a number of fields in a form I would like to format based on values
in a different field. Lets say that each field in my form is a process and
the value of the field is a sequence number that tells what order the fields
will be processed in. In separate hidden fields (editable by double clicking
the object field) is a value of either 1, 2, 3 or null (1 for Process
Pending, 2 for Process Running or 3 for Process Complete).

Lets take my RawStock field for example. Stock cutting is generally the
first process to a job, so the value of this field is usually going to be 1.
What I would like to do is change the StockStatus (1,2 or 3 for Pending,
Running or Closed), and change the backcolor of the RawStock field based on
the value in the StockStatus field rather than the RawStock field.

I believe this can be done using the Expression portion of Conditional
Formatting, but I am really not very good with expression syntax. Ive tried
Me.StockStatus=1 or Me.StockStatus.Value=1 for expressions for formatting but
can't seem to get results. Any help in this matter would be greatly
appreciated. For more details on what I'm working with and how I came about
this problem see my post a few threads down titled "Cont. Form Backcolor by
Record" Thanks again to missinglinq, I've almost got this doing exactly what
I want it to do.

Thanks in advance,
Jack
 

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

Back
Top