Conditional Formating in a continous subform

S

Stephen Wright

Help Please
I am trying to work out how to change the font colours dependant upon
the value of a field in a continous subform

The underlying table is called tblstock and the fields are ProductCode,
ProductCount & Stocktmp
Each record has a unique lineNo - the stocktmp is updated from a query
totalling the quantity of each product
The fields I want to format are ProductICode & ProductCount

The conditional formating always highlight every row

My attempt at coding this into the onload event of the form

If Me!StockTmp > Me!ProductCount Then
Me!ProductId.ForeColor = 255
Else: Me!ProductId.ForeColor = 0

End If

Again the same result as the conditional format

I would be grateful for any suggestions on how to code this


Many thanks


Paul
 
G

Guest

You don't want to be using the onload event of the form. You don't say which
version of Access that you are using, but if it is Access 2000 or later,
there is built in Conditional Formatting for forms and reports. In form
design view, select the textbox in question. Then click on Format >
Conditional Formatting...

There is a KB article for using VBA code to achieve conditional formatting
in Access 97. Also, here is an alternative for you to consider:

Conditional Formatting
http://www.access.qbuilt.com/html/conditional_formatting.html


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Help Please
I am trying to work out how to change the font colours dependant upon
the value of a field in a continous subform

The underlying table is called tblstock and the fields are ProductCode,
ProductCount & Stocktmp
Each record has a unique lineNo - the stocktmp is updated from a query
totalling the quantity of each product
The fields I want to format are ProductICode & ProductCount

The conditional formating always highlight every row

My attempt at coding this into the onload event of the form

If Me!StockTmp > Me!ProductCount Then
Me!ProductId.ForeColor = 255
Else: Me!ProductId.ForeColor = 0

End If

Again the same result as the conditional format

I would be grateful for any suggestions on how to code this


Many thanks


Paul
 

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