View Single Post
  #1 (permalink)  
Old April 24th, 2008, 12:09 PM
camehere camehere is offline
Authorized User
 
Join Date: Feb 2008
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Change Textbox Backcolor for certain records only

Private Sub Form_Load()
On Error GoTo Err1
Dim rs As DAO.Recordset

    Me.Refresh
    Set rs = Me.RecordsetClone
    If rs.RecordCount > 0 Then
        rs.MoveFirst
        Do Until rs.EOF

            If ((Month(Now) = 4) And (rs!Apr = True)) Then

                   rs.Edit
                   rs!Machine.BackColor = 13500152 '(How?)
                   rs.Update


            End If
                rs.MoveNext

        Loop
    End If
    Me.Refresh

Exit_Form_load:
    Exit Sub
Err1:
    MsgBox Err.Description
    Resume Exit_Form_load
End Sub
__________________________________________________ _____________
I aim to change textbox backcolor of a field "Machine" for certain records which have fulfilled some criteria

Set the color of the textbox of field “machine” of records which shows its maintenance schedule is in april.Only those records which has schedule in april will have its corresponding record textbox “machine” set to yellow. But,I typed rs!Machine.Backcolor = 13500152, & error.How should code be?

tried Me.Machine.Backcolor = 13500152 & ended up havin all textboxes “machine” on the form set to yellow.But this is not i want as only some records should have textbox backcolor to yellow. Or any other method to achieve this?

Please help... Thank you..:D

Reply With Quote