Public Function GetRingColour(RingNo As String) As String
'work with IDs instead of ring no
Dim Season As Long
Season = DLookup("Season", "Tbl_Birds", "RingNo = '" & RingNo & "'")
GetRingColour = Nz(DLookup("RingColour", "Tbl_RingColour", "SeasonID = " & Season), 0)
End Function
Public Function ColorText(RingNo As String) As String
Dim ColorTag As String
ColorTag = GetRingColour(RingNo)
ColorText = "<div><font color=#" & ColorTag & ">" & RingNo & "</font></div>"
End Function
=GetRingColour([hen])
=GetRingColour([****])
SELECT tbl_Season.SeasonID, tbl_RingColour.RingColour
FROM tbl_Season INNER JOIN tbl_RingColour ON tbl_Season.SeasonColor = tbl_RingColour.RingColourID;
Public Function GetBirdSeason(RingNo As String) As String
'work with IDs instead of ring no
GetBirdSeason = Nz(DLookup("Season", "Tbl_Birds", "RingNo = '" & RingNo & "'"), 0)
End Function
Public Function GetBirdSeason2(RingNo As String) As String
'work with IDs instead of ring no
Dim BirdID As Long
Dim PairID As Long
BirdID = GetID(RingNo)
PairID = GetPairID(BirdID)
GetBirdSeason2 = Nz(DLookup("Season", "Tbl_Bird_Partnerships", "Pair_ID = " & PairID), 0)
End Function
Public Function GetRingColour(RingNo As String) As Long
'work with IDs instead of ring no
Dim Season As Long
Season = GetBirdSeason(RingNo)
'Season = GetBirdSeaon2(ringNo)
GetRingColour = Nz(DLookup("RingColour", "qry_Season_RingColour", "SeasonID = " & Season), 0)
End Function
Do you mean create a new query or use one that i already have.Then in the partnership query you bring in table birds twice. Once joined to female ringno and once to the male ringno. That will allow you to have a hen colour and **** color field in the query. Then you do simple conditional formatting on those field. If value is black turn it black, if green turn it green. I will send an update. This is fast, simple, easy to maintain.