Before update colour not work?

  • Thread starter Thread starter postman
  • Start date Start date
P

postman

Before update colour not work
There is no effect produced by this code - got from this forum:
"Total_No_Items" is the text box name.
Placed in: textbox's before update event.
*****************************************************************
Private Sub Total_No_Items_BeforeUpdate(Cancel As Integer)

If IsNull(Me.Total_No_Items) Then
Me.Total_No_Items.BackColor = 255 'red
End If

End Sub
*****************************************************************
 
Sorry, my intention was to have it coloured before I tabbed to it, so as to
attract my attention to all boxes requiring data input, then return colour
to white (normal) once input has taken place.
Hope that clarifies things.
 
You should use the Form_Current Event to set it to red if required and then
use the TextBox_AfterUpdate to set it back to white once data is entered in
the box.

Alternatively, you can try to use Conditional Formatting (only available in
A2K or later).

Check Access Help on the above.
 
Ok tried Conditional Formatting, works to some extent with the has focus
condition but does not seem to work on list boxes, of which I have three.
Unable to find "Form_Current Event" as outline below.
So I'll go with the "before update" & "after update" code. What is wrong
with my code? & what would be the syntax for the "after update" event
procedure to return textbox background colour to white? Have checked MS Help
VBA etc, no references found for changing colours.

Thanks.
 
Ok tried Conditional Formatting, works to some extent with the has focus
condition but does not seem to work on list boxes, of which I have three.
Unable to find "Form_Current Event" as outline below.

The Current event is the proper one. View the Form's properties (one
way is to right mouseclick the little square at the upper left
intersection of the rulers and select Properties); on the Events tab
choose the Current event.

John W. Vinson[MVP]
 
Back
Top