I was looking at the text box you created on the form (remaining) but its properties dont reveal how the data is generated.
I used Visual Basic for Application (VBA) code in the On Current event of the main form. This is that code:
Code:
If Me.NewRecord = True Then
Me.remainbalance.Visible = False
Else
Me.remainbalance.Visible = True
Me.remainbalance = CLng(Me.cboStatus.Column(2)) - DSum("daysoff", "qryDaysTaken", "fkOfficerID=" & Me.pkOfficerID)
End If
I used the query qryDaysTaken in conjunction with the DSum() function and the officer ID & combo box (the allocation column) from the main form.
I would have like to have the days taken, days remaining on the main form displayed in red is this possible rather than a report taking in consideration the years and the amount of days allocated per yearl.
This should be possible with some VBA code. Would you just want to show the current year info or for all years? If for all years, you would actually use a subform but then it may be more difficult to do the color coding you wanted.
On completion I realise that if a person inputs a time period for 2 years it will reveal the incorrect days remaining for sick leave. How do you think i should approach this.
You can check the values inputted to make sure the range is only within a 1 year period, if not, reject the values and have the user reenter the values. If you will only want data for a particular year, then just present the user with a choice of years and then you control the actual beginning and ending dates to just that year.