Loop count

  • Thread starter Thread starter Michael Noblet
  • Start date Start date
M

Michael Noblet

I have an IIf statement that looks for blank fields in a
database and fills it in. the Expressions is:

iif([admit date] is null, dlookup("[admit
date]", "tblDiagnosisUnder16Final","[id]=" &[id]-1),[admit
date])

I need to replace the -1 portion after [id] with a
function that counts the number of blank fields as that
number is variable.

therefore the end of the expression would be [id]-
BlankCount([admit date]) or something like that. I know
this needs to have a loop, but I am strugling with setting
up the function to use in the expression. any help would
be appreciated.

Mike
 
Somethink like this? (air code)

Sub BlankCount(rs as recordset)
dim f as field
dim cnt as integer
cnt=0
for each f in rs.fields
if isnull(f.value) then cnt=cnt+1
next
blankcount=cnt
End Sub
 
Back
Top