ش | ی | د | س | چ | پ | ج |
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 |
استفاده از لوپ تو در تو برای استخراج نام فیلدها و مقادیرش ، رکورد به رکورد.
While (Not rs.EOF ) 'Loop 1
For Each field In rs.Fields 'Loop no 2
rowText = rowText & field.Name & "=" & rs.Fields(field.Name) & ", "
Next
Debug.Print rowText
rowText = ""
rs.MoveNext
Wend
The Fields collections of the Index, QueryDef, Relation, and TableDef objects contain the specifications for the fields those objects represent. The Fields collection of a Recordset object represents the Field objects in a row of data, or in a record. You use the Field objects in a Recordset object to read and to set values for the fields in the current record of the Recordset object.
To refer to a Field object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:
Fields(0)
Fields("name")
Fields![name]
Index is ZeroBased
For i =0 To rs.Fields.Count-1
rs.Fields(i).Name
Next