Field2.IsComplex-Eigenschaft (DAO)
Gilt für: Access 2013, Office 2013
Gibt einen Boolean-Wert zurück, der angibt, ob das angegebene Feld ein mehrwertiger Datentyp ist. Schreibgeschützt.
Informationen zur Version
Hinzugefügte Version: Access 2007
Syntax
Ausdruck . IsComplex
Ausdruck Eine Variable, die ein Field2-Objekt darstellt.
Beispiel
Das folgende Beispiel zeigt, wie Sie durch ein Recordset navigieren, das ein Mehrfachwertfeld enthält.
Der Beispielcode stammt von:Microsoft Access 2010 Programmer's Reference.
Sub PrintStudentsAndClasses()
Dim dbs As DAO.Database
Dim rsStudents As DAO.Recordset2 'Recordset for students
Dim rsClasses As DAO.Recordset2 'Recordset for classes
Dim fld As DAO.Field2
'open the database
Set dbs = CurrentDb()
'get the table of students
Set rsStudents = dbs.OpenRecordset("tblStudents")
'loop through the students
Do While Not rsStudents.EOF
'get the classes field
Set fld = rsStudents("Classes")
'get the classes Recordset
'make sure the field is a multi-valued field before
'getting a Recordset object
If fld.IsComplex Then
Set rsClasses = fld.Value
End If
'access all records in the Recordset
If Not (rsClasses.BOF And rsClasses.EOF) Then
rsClasses.MoveLast
rsClasses.MoveFirst
End If
'print the student and number of classes
Debug.Print rsStudents("FirstName") & " " & rsStudents("LastName"), _
"Number of classes: " & rsClasses.RecordCount
'print the classes for this student
Do While Not rsClasses.EOF
Debug.Print , rsClasses("Value")
rsClasses.MoveNext
Loop
'close the Classes Recordset
rsClasses.Close
'get the next student
rsStudents.MoveNext
Loop
'cleanup
rsStudents.Close
Set fld = Nothing
Set rsStudents = Nothing
Set dbs = Nothing
End Sub