Share via


MoveFirst method

Sets the current record of the record set to the first record.

Applies to

Objects: Recordset

Syntax

object.MoveFirst

Parameters

Part

Description

object

Required. An expression that returns a Recordset object.

Example

Sub TraverseRecordset()

  Dim objApp As New MapPoint.Application
  Dim objPin As MapPoint.Pushpin
  Dim objRS As MapPoint.Recordset
  Dim iLRTotal, iTotal As Integer

  'Find Pushpin
  Set objPin = objApp.OpenMap(objApp.Path & "\Samples\Clients.ptm").FindPushpin("Jenny Sax Proseware, Inc.")

  'Get all records for this Pushpin's data set
  Set objRS = objPin.Parent.QueryAllRecords

  'Point the record set to the Pushpin
  objRS.MoveToPushpin objPin
  iLRTotal = CInt(objRS.Fields("November"))

  'Use the record set again
  objRS.MoveFirst

  Do Until objRS.EOF
    iTotal = iTotal + CInt(objRS.Fields("November"))
    objRS.MoveNext
  Loop

  'Percentage of total sales for November
  MsgBox CStr(100 * iLRTotal / iTotal) & "%"

End Sub