Hi all,

I'm using Crystal 8.5 with VB6 and Access 2000.

Crystal is generating a report from the Access Database.

In the Database table, there is a field called ReportPage.

I want to be able to skip to the Next page of the report each time the Previous
Value in ReportPage is greater than the Value in the Current Reportpage.

I am using a Recordset object, and below is my code:


Public Sub BuildReport(ByVal sFileName As String)

On Error GoTo EH_BuildReport

CreateReportFolders

Select Case g_ReportType
Case RPT_ACCTSummary
'BuildAccountSummary sFileName
sisBuildAccountSummary sFileName
Case RPT_OrderReport
BuildOrderReport sFileName
Case RPT_WhitePages
BuildWhitePages sFileName
Case RPT_Unknown

End Select

Exit Sub
EH_BuildReport:
ManageErrors "BuildReport", m_ReportMode
End Sub


Public Sub sisBuildAccountSummary(ByVal sFileName As String)

Dim g_SQLString As String
Dim g_FLDString As String
Dim fsoLocal As FileSystemObject


' save file content to table
'Dim m_Connection As New ADODB.Connection
Dim RS As New ADODB.Recordset
Dim strConnect As String
Dim PageNum As Long

On Error GoTo EH_sisBuildAccountSummary

Set RS = New ADODB.Recordset



'm_Connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & App.Path & "\ReportPro.mdb;User Id=admin;Password=;"
m_Connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
_
& Hold_MDB_FilePath & "\ReportPro.mdb;User Id=admin;Password=;"

m_Connection.Open

'GetReportFileName

'process each line in the file

If Not (g_Report Is Nothing) Then Set g_Report = Nothing
Set g_Report = New AccountSummary
'fa --Added by...2/6/2002
'Set g_Report = New AccountSummary

'Set g_crxDatabase = g_Report.Database
'Set g_crxDatabaseTables = g_crxDatabase.Tables
'Set g_crxDatabaseTable = g_crxDatabase.Tables.Item(1)


'fa --Added by...2/6/2002

g_Report.PaperOrientation = crLandscape


'MsgBox RS.Fields.Item
g_SQLString = "Select * From Accountsummary WHERE ReportName = '" & UCase(Trim(Hold_RawFile_2Proc_Path))
& "'"
'g_SQLString2 = g_SQLString
'MsgBox "g_SQLString: " & g_SQLString

RS.Open g_SQLString, m_Connection, adOpenDynamic, adLockBatchOptimistic
g_Report.Database.SetDataSource RS


' Cleanup
'm_Connection.Close
'Set RS = Nothing ' Cleanup
Set fsoLocal = Nothing

'Set fileSource = Nothing
'Set tsSource = Nothing
'-- Exit the procedure.
Exit Sub
EH_sisBuildAccountSummary:
ManageErrors "sisBuildAccountSummary", m_ReportMode
End Sub



' *************************************************************
' Exports the processed report to the given folder with an option to preview
'
Public Sub ExportReport(Optional bPromptUser As Boolean = False, Optional
bPrintReport As Boolean = False)

On Error GoTo EH_ExportReport



If Not (g_Report Is Nothing) Then
g_Report.ExportOptions.DestinationType = crEDTDiskFile
g_Report.ExportOptions.FormatType = crEFTCrystalReport
'g_Report.ExportOptions.DiskFileName = m_OutPutFilePath & "\" & m_ReportFileName
& ".rpt"
'g_Report.ExportOptions.DiskFileName = m_OutPutFilePath & "\" & Hold_RawFileName
& ".rpt"
g_Report.ExportOptions.DiskFileName = Hold_OutPutFilePath & Hold_RawFileName
& ".rpt"
g_Report.Export bPromptUser

'g_Report.PrintOut True

If bPrintReport Then g_Report.PrintOut Not (bPrintReport)
End If
'PurgeDataBase
Exit Sub
EH_ExportReport:
ManageErrors "ExportReport", m_ReportMode
End Sub



Thanks in advance,
Felix