View Single Post
  #5   Report Post  
JoePineapples JoePineapples is offline
Junior Member
 
Posts: 7
Default

I have a very limited knowlege of vb.

I have the following code to resolve the first problem:

Private Sub txtDifference_change()
'Change colour to red if txtdifference 10% or -10%
If Left(txtDifference.Text, Len(txtDifference.Text) - 1) 10 Or Left(txtDifference.Text, Len(txtDifference.Text) - 1) (-10) Then
txtDifference.ForeColor = &HFF&
Else
txtDifference.ForeColor = &H0&
End If

End Sub

I'm hoping this will form the basis of my next part.

Thanks

JP



[quote=Eddie Holder]Are you familiar with VB.

If you have a form in VB, all controls will have events attached to them. If
you double click on the control which you enter the reoported field, choose
the event (top right dropdown in VB) and set it to after_update (or change).

Your code will look something like this.

sub starts
If me.control1me.controlname2 then
me.control3.enable
msgbox " Enter a reason in reason field"
me.control3.interior.color=vbred
me.control3.setfocus
end if

sub ends

In the above example, me refers to the current userform. I also assume you
have named all controls etc.

Hope this helps

Eddie