Thats exactly what I wanted Dirk! One last thing if you can.
When I find a not null value from the recordset, I want to assign the
[quoted text clipped - 15 lines]
Quite simple, if I understand you properly. You can take advantage of the
fact that controls can be indexed by name in the form's Controls collection.
Something like this:
'------ start of example code ------
Dim rs As DAO.Recordset
Dim fld As DAO.Field
Dim blnFoundNullField As Boolean
Dim intCount As Integer
Set rs = ... ' something appropriate
For Each fld In rs.Fields
If IsNull(fld.Value) Then
blnFoundNullField = True
Exit For
Else
intCount = intCount + 1
With Me.Controls("Label" & intCount)
.Caption = fld.Value
.Visible = True
End With
End If
Next fld
' Clean up objects.
Set fld = Nothing
rs.Close ' ONLY DO THIS IF YOU OPENED THE RECORDSET
Set rs = Nothing
' Hide unused labels.
While intCount < 10
intCount = intCount + 1
Me.Controls("Label" & intCount).Visible = False
Wend
If blnFoundNullField Then
MsgBox "Found a Null field!"
Else
' Do something
End If
'------ end of example code ------