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

OnCurrent Form event does not refresh current records

Status
Not open for further replies.

mischief911

Technical User
Jan 14, 2002
21
US
I am trying to set the backcolor/forecolor property for four textboxes on a form based upon the whether different combinations of the textboxes currently contain data (is not null) I hooked this event to the Form's OnCurrent event. Stepping through my code the conditional statements correctly detect when the four textboxes respective colors should be set for based upon the data contents of a given record. However, when I move to a new record in the recordset the textboxes remain in the state for the record that first set them - no form refresh or control refresh event occurs to reset them to the appropriate values for the record currently displayed. Any ideas what
 
Are you settin the controls BACK to their original colours if your conditions are NOT met? Sorry if I am stating the obvious but this is the first thing that springs to mind!!
Jamie Gillespie
j-gillespie@s-cheshire.ac.uk
 
I just tried this, and made it work ok. Here's the code I used:

Private Sub Form_Current()
If IsNull(Me!column2) Then
Me!column2.BackColor = 65535
Else
Me!column2.BackColor = 16777215
End If
End Sub

Is the OnCurrent property being initiated each time you move to a new record? How are you moving to a new record - using the standard navigation buttons or by some other method?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top