Detail format problem!

D

Domac

Hi,


I would like to set foreground color of textbox on subform depending on
value of booleann field.
Problem is that i can't catch event Detail_format that i used when doing
same task on report.

If value is 1 then color of textbox is red if it is 0 then color is black.

Subform is in continuos form view and I can't get detail_format event !!??

Please help!
Domagoj
 
J

Jeff L

Take a look at conditional formatting. I think that will do what you
are looking for.
 
A

Allen Browne

Forms are very different than reports, and have different events.

The Current event of the form fires when a record becomes current. But if
this is a continuous form or datasheet, you will not be able to use code in
this event: all rows will change, not just the current row.

Instead, use Condtional Formatting.
(This assumes Access 2000 or later.)

Open the form in design view.
Select the text box that should change color.
Choose Conditional Formatting on the Format menu.
Set Condition 1 to:
Expression ([MyBoolean])
and click the red text.
Use the name of your boolean field instead of MyBoolean.

(Note that True is -1 rather than 1 if you are talking about a yes/no field
in an Access table.)
 
J

Jeff L

Oops! Sorry Allen. I misread the post!

Allen said:
Forms are very different than reports, and have different events.

The Current event of the form fires when a record becomes current. But if
this is a continuous form or datasheet, you will not be able to use code in
this event: all rows will change, not just the current row.

Instead, use Condtional Formatting.
(This assumes Access 2000 or later.)

Open the form in design view.
Select the text box that should change color.
Choose Conditional Formatting on the Format menu.
Set Condition 1 to:
Expression ([MyBoolean])
and click the red text.
Use the name of your boolean field instead of MyBoolean.

(Note that True is -1 rather than 1 if you are talking about a yes/no field
in an Access table.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Domac said:
I would like to set foreground color of textbox on subform depending on
value of booleann field.
Problem is that i can't catch event Detail_format that i used when doing
same task on report.

If value is 1 then color of textbox is red if it is 0 then color is black.

Subform is in continuos form view and I can't get detail_format event !!??

Please help!
Domagoj
 

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

Similar Threads


Top