[AccessD] Instant If Then Else

Gustav Brock gustav at cactus.dk
Thu Aug 12 11:22:02 CDT 2004


Hi Paul

To completely confuse you, Change (your own suggestion) is the event
to pick for this. 
It works also for a paste of text by the user.

Also, you could lighten your code a bit and use the Text property:

  With Me!txtFun
    If Len(.Text) > 0 Then
      .BackColor = vbRed
      .ForeColor = vbYellow
    Else
      .BackColor = vbWhite
      .ForeColor = vbBlack
    End If
  End With

Or use two variables for the colours.

/gustav


> Can I make these changes the instant the User enters a text box, please?

> If Not IsNull([txtFun]) Then
>   Me.txtFun.BackColor = vbRed
>   Me.txtFun.ForeColor = vbYellow
> Else
>   Me.txtFun.BackColor = vbWhite
>   Me.txtFun.ForeColor = vbBlack
> End If

> I mean as he types "y" for "yes", or anything at all? The above doesn't work
> till the record changes. 




More information about the AccessD mailing list