Answered by:
header in form

Question
-
i have a continuous form
person1 some data
person1 some data
person1 some data
person2 some data
person2 some data
person3 some data
person 3 some data
is there a way , perhaps conditional formatting , to give the first record of each person a color or font, or line or ..
so that one immediately can see in the list the data aout that person is starting here ?
Tuesday, November 20, 2018 1:21 PM
Answers
-
The description of your form suggests that you might do better to use a main form/subform arrangement, where the main form has one record for each person, and the subform has the detail data lines for that person.
However, with your current form, you could create a function along these lines in the form's module:
Public Function IsFirstRecordForPerson() As Boolean With Me.RecordsetClone .Bookmark = Me.Bookmark On Error Resume Next .MovePrevious If Err.Number <> 0 Then IsFirstRecordForPerson = True Else If !PersonID <> Me.PersonID Then IsFirstRecordForPerson = True Else IsFirstRecordForPerson = False End If End If End With End Function
And then create a conditional formatting rule like this:
Expression is: IsFirstRecordForPerson()
to set, e.g., a highlighting backcolor.
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html- Marked as answer by tekoko10 Tuesday, November 27, 2018 2:00 PM
Tuesday, November 20, 2018 9:19 PM
All replies
-
I would put a combo box in the header that lets the user select a person to filter on. If you use the control wizard it will set it up for you.
Bill Mosca
www.thatlldoit.com
http://tech.groups.yahoo.com/group/MS_Access_ProfessionalsTuesday, November 20, 2018 3:14 PM -
Hi,
I agree with Bill but does your table have an ID field? If so, then you should be able to do what you want by adding an expression to maybe calculate the lowest ID per person and highlight it.
Just a thought...
Tuesday, November 20, 2018 4:07 PM -
The description of your form suggests that you might do better to use a main form/subform arrangement, where the main form has one record for each person, and the subform has the detail data lines for that person.
However, with your current form, you could create a function along these lines in the form's module:
Public Function IsFirstRecordForPerson() As Boolean With Me.RecordsetClone .Bookmark = Me.Bookmark On Error Resume Next .MovePrevious If Err.Number <> 0 Then IsFirstRecordForPerson = True Else If !PersonID <> Me.PersonID Then IsFirstRecordForPerson = True Else IsFirstRecordForPerson = False End If End If End With End Function
And then create a conditional formatting rule like this:
Expression is: IsFirstRecordForPerson()
to set, e.g., a highlighting backcolor.
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html- Marked as answer by tekoko10 Tuesday, November 27, 2018 2:00 PM
Tuesday, November 20, 2018 9:19 PM