home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 6 Unleashed…sional Reference Edition) / Visual_Basic_6_Unleashed_Professional_Reference_Edition_Sams_1999.iso / Source / CHAP08 / 309X0807.TXT < prev    next >
Encoding:
Text File  |  1998-06-17  |  1.3 KB  |  43 lines

  1.  
  2. Private Sub hsbRecScroll_Change()
  3.  
  4. ' If rsMain has not been assigned, do nothing.
  5. If Not (rsMain Is Nothing) Then
  6.     ' Move to the record number indicated by the
  7.     ' scroll bar.
  8.     rsMain.AbsolutePosition = hsbRecScroll.Value
  9.     ' Check for a BOF condition...
  10.     If rsMain.BOF Then
  11.         ' The recordset is at BOF. The action to take
  12.         ' is specified by the BOFAction property.
  13.         Select Case msdcBOFAction
  14.             Case sdcBOFActionConstants.sdcMoveFirst
  15.                 rsMain.MoveFirst
  16.             Case Else
  17.                 Exit Sub
  18.         End Select
  19.         Exit Sub
  20.     End If
  21.     ' Check for an EOF condition...
  22.     If rsMain.EOF Then
  23.         ' The recordset is at EOF. The action to take
  24.         ' is specified by the EOFAction property.
  25.         Select Case msdcEOFAction
  26.             Case sdcEOFActionConstants.sdcMoveLast
  27.                 rsMain.MoveLast
  28.             Case sdcEOFActionConstants.sdcAddNewRecord
  29.                 ' Add a new record, and update the
  30.                 ' scroll bar's Max and Value
  31.                 ' properties.
  32.                 rsMain.AddNew
  33.                 hsbRecScroll.Max = rsMain.RecordCount + 1
  34.                 hsbRecScroll.Value = rsMain.RecordCount + 1
  35.             Case Else
  36.                 Exit Sub
  37.         End Select
  38.         Exit Sub
  39.     End If
  40. End If
  41.  
  42. End Sub
  43.