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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic changing of object attributes

Status
Not open for further replies.

ShaneBrennan

Programmer
May 19, 1999
198
0
0
GB
I wish to create forms and reports where I can highlight numberical values.<br>
<br>
Examples when stock levels are below minimum stock level need to be red<br>
whilst stock levels above minimum stock level remian black!<br>
<br>
I can create macros to change the front colour and backcolor I DON'T know how to check the stock level with the minimum level. I've seen there is an IIF command like Excel, so is there a varient of this command that I can use.<br>
<br>
Eg.<br>
<br>
IIF( [Current Stock Level] &gt;= [ mimimum stock level], set color to black, set color to red)<br>
<br>
I would appreciate any help<br>
<br>
Thanks <br>
<br>
Shane<br>
(Seriously frustrated making things look pretty)<br>

 
Reports: you could use the Format event of the appropriate section to compare the value in a text box against a minimum value and set the colours accordingly.<br>
<br>
I'm not sure if you could do something similar for forms though.<br>
<br>
Jonathan
 
Hi Jonathan<br>
<br>
I've founf the On Format event in the details section, but I have no idea of how to use it.<br>
<br>
The help facility is as clear as mud!<br>
<br>
Can you explain how to use this, please<br>
<br>
Thanks <br>
<br>
Shane
 
Hi Jonathan<br>
<br>
I've pursevered with the on Format command<br>
<br>
Talk about getting the Macros to work, I've never had so much problem getting the conditions correct.<br>
<br>
Thank you VERY much for your help<br>
<br>
Shane
 
I just worked on a similar problem. I needed to change the color of form fields based on certain criteria. The colors need to change each time a new record is displayed. I used the OnCurrent Form event with VBA code. An example follows:<br>
<br>
Private Sub Form_Current()<br>
Const BLACK As Integer = 0<br>
Const RED As Integer = 255<br>
<br>
<br>
If IndemAmt = OrigIndemAmt _<br>
Or IsNull(OrigIndemAmt) Then<br>
txtIndemAmt.ForeColor = BLACK<br>
Else<br>
txtIndemAmt.ForeColor = RED<br>
End If<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top