Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help with DSum

Status
Not open for further replies.

shiggyshag

Programmer
Dec 14, 2001
227
GB
Hi

I am converting an access 2 database to an ADP and things are going ok until this.

I have the following as a control source

=DSum("Meetings","tStaffTimeAllowances","([StaffID] = cStaffID) And fnBetween((cRefDate),([StartDate]),(IIf(IsNull([EndDate]),'01/01/2050',[EndDate])),0)")/60

andd the fnBetwwen is this

Function fnBetween(TestDate As Variant, FirstDate As Variant, LastDate As Variant, NullReturn As Integer) As Integer
Dim tDate As Variant
Dim fDate As Variant
Dim LDate As Variant
If IsNull(TestDate) Then
fnBetween = NullReturn
Else
tDate = CVDate(TestDate)
fDate = CVDate(FirstDate)
LDate = CVDate(LastDate)
If tDate >= fDate And tDate <= LDate Then
fnBetween = 1
Else
fnBetween = 0
End If
End If
End Function

Now how can i do this in a project?
As you can not use the function within the Dsum or so it seems.

I guess I need to use a SP but I really dont know where to start any help would be great

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top