Propiedad Field2.IsComplex (DAO)
Se aplica a: Access 2013, Office 2013
Devuelve un valor de tipo Boolean que indica si el campo especificado es un campo multivalor. Solo lectura.
Información de versión
Versión añadida: Access 2007
Sintaxis
expresión . IsComplex
expression Variable que representa un objeto Field2.
Ejemplo
El siguiente ejemplo muestra cómo desplazarse por un Recordset que contiene un campo multivalor.
Código de ejemplo proporcionado por la Referencia del programador de Microsoft Access 2010.
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