GetChunk Method

Applies To   Field object.

Description

Returns all or a portion of the contents of a Memo or Long Binary Field object in the Fields collection of a Recordset object.

Syntax

Set variable = recordset! field.GetChunk(offset, numbytes)

The GetChunk method syntax has these parts.

Part

Description

variable

A Variant (String subtype) that receives the data from the Field object named by field.

recordset

An object variable that represents the Recordset object containing the Fields collection.

field

An object variable that represents a Field object whose Type property is set to dbMemo (Memo) or dbLongBinary (Long Binary).

offset

A Long value equal to the number of bytes to skip before copying begins.

numbytes

A Long value equal to the number of bytes you want to return.


Remarks   The bytes returned by GetChunk are assigned to variable. Use GetChunk to return a portion of the total data value at a time. You can use the AppendChunk method to reassemble the pieces.

If offset is 0, GetChunk begins copying from the first byte of the field.

If numbytes is greater than the number of bytes in the field, GetChunk returns the actual number of remaining bytes in the field.


Caution   Use a Memo field for text, and put binary data only in Long Binary fields. Doing otherwise will cause undesirable results.


See Also

AppendChunk method, FieldSize property, Type property.

Specifics (Microsoft Access)

After assigning the results of the GetChunk method to a string variable, you can use the Visual Basic Len function to determine the number of characters in the string. Or you can use the LenB function to determine the number of bytes used to represent that string.

Example

See the AppendChunk method example.

Example (Microsoft Access)

See the AppendChunk method example (Microsoft Access).