Formatting only First Row of table

158 views Asked by At

I have an MS Access continuous form on onload event i am getting MyTable Record, upto here its fine. But i want to change the color of only first row

MyTable

Id ¦ Name ¦  Months ¦ Years
------------------
1  ¦ Ali  ¦ 01 ¦ 2020
2  ¦ Umar ¦ 02 ¦ 2020
3  ¦ Abid ¦ 03 ¦ 2019
4  ¦ Sana ¦ 04 ¦ 2020

I used this code

Dim tblCount, Countr as Integer
tblCount = Dcount("Years", "MyTable")
For Countr = 1 to tbleCount
 If countr = 1 Then
   Me.Years.ForeColor = vbred
 Else
   Me.Years.ForeColor = vbblack
End If
Next Countr

When countr = 1 it shows all Years Column Red and when Countr > 1 Years Column becomes black But i want only first row Years Red rest all rows Black

I really thankful to you plzz help me

0

There are 0 answers