Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Color by Record on a Form

Status
Not open for further replies.

Tzokas

Programmer
Mar 2, 2001
24
GR
Hi to everyone.
Well, i have a bit strange(?) question.

I have a Continuous Form based on a table with 4 fields, say f_A, f_B, f_C, f_D and all of them exist on the Form.
f_A is an integer and can take these values:1725,343,7408,9054 and may appears many times on the Form.

Is it possible for each different value of f_A, the other fields to have different colour;

I DO NOT want this to happen when i move from record to record.

All that i want is the different colour to be appeared instantly when i open the Form.

I think that there is a way but i can thing absolutely nothing

Thanks.
 
Check out the "Format" property for the field. In Access 97 this can be used to set up to four different formats dependant upon four different values.

I understand that there is a more flexible Format property in Access 2000, but I haven't used that version, so I don't known very much about this property. Try doing a keyword search on this form using "Format"

HTH

Lightning
 
For each field in a subform that you want to be able to change to a different color based on record values, you make four text boxes, each with unique names, such as Field1A, Field1B, Field1C, Field1D, Field2A, Field2B, Field2C, and Field2D. Just stack them on top of each other and use the Field Selector drop down list on the toolbar to "select" which one you want to work with at a time. Set the appropriate BackColor and ForeColor properties for each text box. All the "A" text boxes would be the same, corresponding to integer 1725, for example. All the "B" text boxes would the same, corresponding to integer 343, for example. And so forth. Then, in the "OnCurrent" event for the record, use a Select Case statement to make the appropriate text boxes visible. For example:

Select Case intChoice
Case 1725
Me!Field1A.Visible = True
Me!Field1B.Visible = False
Me!Field1C.Visible = False
Me!Field1D.Visible = False
Me!Field2A.Visible = True
Me!Field2B.Visible = False
Me!Field2C.Visible = False
Me!Field2D.Visible = False
(etc.)
Case 343
Me!Field1A.Visible = False
Me!Field1B.Visible = True
Me!Field1C.Visible = False
Me!Field1D.Visible = False
Me!Field2A.Visible = False
Me!Field2B.Visible = True
Me!Field2C.Visible = False
Me!Field2D.Visible = False
(etc.)
Case Else
...
End Select
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top