home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / History.cls < prev    next >
Text File  |  1997-11-01  |  1KB  |  42 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "History"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Option Explicit
  11.  
  12. Function ListHistoryForId(ByVal strFileDSN As String, ByVal lngAccountID As Long)
  13.     
  14.     Dim objContext As ObjectContext
  15.     Set objContext = GetObjectContext
  16.     
  17.     On Error GoTo ErrorHandler
  18.     
  19.     Dim strSQL As String
  20.     Dim rst As New ADODB.Recordset
  21.              
  22.     strSQL = "SELECT t.FlightDate, fs.Origin, fs.Destination, t.Miles, t.Comment " & _
  23.              "FROM Transactions t " & _
  24.              "JOIN FlightSchedule fs " & _
  25.                "ON Convert(int, fs.FlightNo) = t.FlightNo " & _
  26.              "WHERE t.AccountID = " & lngAccountID & _
  27.              " ORDER BY t.FlightDate"
  28.     
  29.     rst.CursorLocation = adUseServer
  30.     rst.Open strSQL, "FILEDSN=" & strFileDSN, adOpenStatic, adLockReadOnly, adCmdText
  31.     Set ListHistoryForId = rst
  32.     
  33.     Exit Function
  34.     
  35. ErrorHandler:
  36.     If Not rst Is Nothing Then Set rst = Nothing
  37.  
  38.     objContext.SetAbort
  39.     Err.Raise Err.Number, "History.ListHistoryForId()", Err.Description
  40.  
  41. End Function
  42.