適用先: Access 2013、Office 2013
指定されたフィールドが複数値データ型かどうかを示すブール型 ( Boolean) の値を返します。 読み取り専用です。
バージョン情報
追加バージョン: Access 2007
構文
式 。IsComplex
式Field2 オブジェクトを表す変数。
例
次の例は、複数値フィールドが含まれる Recordset 内を移動する方法を示します。
サンプル コードの提供元: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