Don't have the code as yet that's what I'm trying to figure out.
But essentially it would look something similar to this However this is in VBA format not sql server
Code:
Function Readmits (ByRef mbr as String,vardate as date) As Integer
Dim strsql as string, rs as new adodb.recordset
strsql = "Select datefrom from dbo_claims where mbr_keyid = " & mbr & " and datefrom > #" & vardate & "#"
rs.open strsql,currentproject.connection,adopenforwardonly,adlockreadonly
Do until rs.eof
If readmits = 0 then
If datediff("d",vardate,rs!datefrom) < 30 then Readmits = 1 Else Readmits = 0
End if
rs.movenext
Loop
rs.close
set rs = nothing