Referencing a Filed name in VB Code

G

Graham M Haines

I want to check if 16 fields in a recordset are null or not. The Filed
names are Module01, Module02, Module02 etc

I am assigning the name of the field to a variable and then checking if
filed value is null or not. I am having problems referencing the fields
name

For intmodfieldcnt = 1 To 16 '
If intmodfieldcnt < 10 Then
strfldname = "Module" & "0" & intmodfieldcnt
Else
strfldname = "Module" & intmodfieldcnt
End If

with rst
If Not IsNull(rst.Field(strfldname) Then ' This is the problem line
Do subroutine
Else
Skip
End if
End With

--
Regards

Graham

Graham Haines
 
Top