I have an unbound check box on a form and I want to set the value of the check box to the return value of the function in the parent fors Current event procedure i.e. the relevant values into the function to 'check the box ' if a fee is due. Exactly what part of the function is the return value?
Function:-
Function:-
Public Function FeeDue(lngMemberID As Long, _
intDay As Integer, _
intMonth As Integer, _
intYearsMembership) As Boolean
Dim dtmRenewalDate As Date
Dim strCriteria As String
' set default return value to False
FeeDue = False
' get renewal date in current year
dtmRenewalDate = DateSerial(Year(VBA.Date), intMonth, intDay)
' if current date before renewal date subtract one year
If VBA.Date < dtmRenewalDate Then
dtmRenewalDate = DateAdd("yyyy", -1, dtmRenewalDate)
End If
' has member paid fee since renewal date?
strCriteria = "MemberID = " & lngMemberID & " And PaymentDate >= #" & _
Format(dtmRenewalDate, "mm/dd/yyyy") & " #"
If IsNull(DLookup("MemberID", "S_Payments_Table", strCriteria)) Then
' no payment made since renewal date.
' has member been member for <= specified YearsMembership?
' i.e. how many payments have they made to date
strCriteria = "MemberID = " & lngMemberID
If Dcount("*", "S_Payments_Table", strCriteria) <= intYearsMembership Then
FeeDue = True
End If
End If
End Function
Last edited: