I am using VB6 sp3 with Crystal Reports 7 and Access 97...
ok when you are writting a program and you use the Crystal Reports
Control (just one) when I go to print something the first report comes
out great but when I generate and run the second report it comes out
blank except for the labels on the page no data.. Let me explain I am
taking data from an access 97 database and when the user is searching
for specific data it takes the results of all the data found and puts it
into another access 97 database (reports.mdb) that gets cleared out
prior to running the report to put new data into it.. It is pretty much
a database that is for dumping data to generate the Report from. So now
my problem is this I ran one report and it came out great the second
came out blank except forthe lables no data but when I checked the table
the data was all there for the second report but never got printed.. Now
if I do
frmAbout.rptReport.WindowShowRefreshBtn = True
frmAbout.rptReport.Destination = crptToWindow
frmAbout.rptReport.DataFiles(0) = LIBRARYSERVICES_REPORT_PATH
frmAbout.rptReport.ReportFileName = App.Path &
"\report\rptCurrentRecord2.rpt"
frmAbout.rptReport.Action = 1
and use the refresh button the data it is all there and prints out...
There has got to be a beter easier way to do this... I just want to put
this code in like below and know when it prints it is all going to come
out to the printer.
frmAbout.rptReport.Destination = crptToPrinter
frmAbout.rptReport.DataFiles(0) = LIBRARYSERVICES_REPORT_PATH
frmAbout.rptReport.ReportFileName = App.Path &
"\report\rptCurrentRecord2.rpt"
frmAbout.rptReport.Action = 1
I am attaching a text file with the code from that form....
Thanx
George
[
CrystalProblem.txt 17K ]
'This program was written and designed by George Goehring
'Date: 02/02/2000
'Library Services
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdPrint_Click()
On Error GoTo Error
ResetDataBase1
ResetDataBase2
ResetDataBase3
ResetDataBase4
Select Case giSearch
Case 1
frmPrintOptions.Show vbModal, Me
frmSearchList.Refresh
If giPrintOption = 0 Then
Data5.Recordset.AddNew
Data5.Recordset!lookupdata = UCase(gstSearchField & " / " & gstSearchString)
Data5.Recordset!Number = text1.Text
Data5.Recordset!Title = text2.Text
Data5.Recordset!author = text3.Text
Data5.Recordset!Source = text4.Text
Data5.Recordset!Date = text5.Text
Data5.Recordset!subject = text6.Text
Data5.Recordset!Location = text7.Text
Data5.Recordset!Status = text8.Text
Data5.Recordset!Type = text9.Text
Data5.Recordset.Update
PrintCurrentRecord
GoTo cmdPrint_Click_Exit
End If
If giPrintOption = 1 Then
PrintAllRecord
GoTo cmdPrint_Click_Exit
End If
Case 2
frmPrintOptions.Show vbModal, Me
frmSearchList.Refresh
If giPrintOption = 0 Then
Data6.Recordset.AddNew
Data6.Recordset!lookupdata = UCase(gstSearchField & " / " & gstSearchString)
Data6.Recordset!assn = text10.Text
Data6.Recordset!address = text11.Text
Data6.Recordset!city = text12.Text
Data6.Recordset!State = text13.Text
Data6.Recordset!zip = text14.Text
Data6.Recordset!phone = text15.Text
Data6.Recordset!fax = text16.Text
Data6.Recordset!email = text17.Text
Data6.Recordset!member_name = text18.Text
Data6.Recordset!member_number = text19.Text
Data6.Recordset!payment = text20.Text
Data6.Recordset!notes = text21.Text
Data6.Recordset!expiration_date = text22.Text
Data6.Recordset!dept_number = text23.Text
Data6.Recordset!paid_by = text24.Text
Data6.Recordset.Update
PrintCurrentRecord
GoTo cmdPrint_Click_Exit
End If
If giPrintOption = 1 Then
PrintAllRecord
GoTo cmdPrint_Click_Exit
End If
Case 3
frmPrintOptions.Show vbModal, Me
frmSearchList.Refresh
If giPrintOption = 0 Then
Data5.Recordset.AddNew
Data5.Recordset!lookupdata = UCase(gstSearchField & " / " & gstSearchString)
Data5.Recordset!Number = text25.Text
Data5.Recordset!Title = text26.Text
Data5.Recordset!author = text27.Text
Data5.Recordset!Source = text28.Text
Data5.Recordset!Date = text29.Text
Data5.Recordset!subject = text30.Text
Data5.Recordset!Location = text31.Text
Data5.Recordset!Status = text32.Text
Data5.Recordset!Type = text33.Text
Data5.Recordset.Update
PrintCurrentRecord
GoTo cmdPrint_Click_Exit
End If
If giPrintOption = 1 Then
PrintAllRecord
GoTo cmdPrint_Click_Exit
End If
Case 4
frmPrintOptions.Show vbModal, Me
frmSearchList.Refresh
If giPrintOption = 0 Then
Data7.Recordset.AddNew
Data7.Recordset!lookupdata = UCase(gstSearchField & " / " & gstSearchString)
Data7.Recordset!Title = text34.Text
Data7.Recordset!date_from = text35.Text
Data7.Recordset!date_to = text36.Text
Data7.Recordset!routing = text37.Text
Data7.Recordset!expiration_date = text38.Text
Data7.Recordset!payment = text39.Text
Data7.Recordset!paid_by = text40.Text
Data7.Recordset.Update
PrintCurrentRecord
GoTo cmdPrint_Click_Exit
End If
If giPrintOption = 1 Then
PrintAllRecord
GoTo cmdPrint_Click_Exit
End If
Case 5
frmPrintOptions.Show vbModal, Me
frmSearchList.Refresh
If giPrintOption = 0 Then
Data5.Recordset.AddNew
Data5.Recordset!lookupdata = UCase(gstSearchField & " / " & gstSearchString)
Data5.Recordset!Number = text41.Text
Data5.Recordset!Title = text42.Text
Data5.Recordset!author = text43.Text
Data5.Recordset!Source = text44.Text
Data5.Recordset!Date = text45.Text
Data5.Recordset!subject = text46.Text
Data5.Recordset!Location = text47.Text
Data5.Recordset!Status = text48.Text
Data5.Recordset!Type = text49.Text
Data5.Recordset.Update
PrintCurrentRecord
GoTo cmdPrint_Click_Exit
End If
If giPrintOption = 1 Then
PrintAllRecord
GoTo cmdPrint_Click_Exit
End If
Case 6
frmPrintOptions.Show vbModal, Me
frmSearchList.Refresh
If giPrintOption = 0 Then
Data5.Recordset.AddNew
Data5.Recordset!lookupdata = UCase(gstSearchField & " / " & gstSearchString)
Data5.Recordset!Number = text50.Text
Data5.Recordset!Title = text51.Text
Data5.Recordset!author = text52.Text
Data5.Recordset!Source = text53.Text
Data5.Recordset!Date = text54.Text
Data5.Recordset!subject = text55.Text
Data5.Recordset!Location = text56.Text
Data5.Recordset!Status = text57.Text
Data5.Recordset!Type = text58.Text
Data5.Recordset.Update
PrintCurrentRecord
GoTo cmdPrint_Click_Exit
End If
If giPrintOption = 1 Then
PrintAllRecord
GoTo cmdPrint_Click_Exit
End If
Case 7
frmPrintOptions.Show vbModal, Me
frmSearchList.Refresh
If giPrintOption = 0 Then
Data8.Recordset.AddNew
Data8.Recordset!lookupdata = UCase(gstSearchField & " / " & gstSearchString)
Data8.Recordset!callnumber = text59.Text
Data8.Recordset!Title = text60.Text
Data8.Recordset!edition = text61.Text
Data8.Recordset!author = text62.Text
Data8.Recordset!subject = text63.Text
Data8.Recordset!publisher = text64.Text
Data8.Recordset!Year = text65.Text
Data8.Recordset!Format = text66.Text
Data8.Recordset!checkedout = text67.Text
Data8.Recordset!whocheckedout = text68.Text
Data8.Recordset!datecheckedout = text69.Text
Data8.Recordset!isbn = text70.Text
Data8.Recordset!notes = text71.Text
Data8.Recordset.Update
PrintCurrentRecord
GoTo cmdPrint_Click_Exit
End If
If giPrintOption = 1 Then
PrintAllRecord
GoTo cmdPrint_Click_Exit
End If
End Select
cmdPrint_Click_Exit:
Exit Sub
Error:
MsgBox Err.Description, vbExclamation, "Error Found [PrintCurrentRecord]"
End Sub
Private Sub Form_Load()
On Error GoTo Error
Data1.DatabaseName = LIBRARYSERVICES_SEARCH_PATH
Data2.DatabaseName = LIBRARYSERVICES_SEARCH_PATH
Data3.DatabaseName = LIBRARYSERVICES_SEARCH_PATH
Data4.DatabaseName = LIBRARYSERVICES_SEARCH_PATH
Data5.DatabaseName = LIBRARYSERVICES_REPORT_PATH
Data6.DatabaseName = LIBRARYSERVICES_REPORT_PATH
Data7.DatabaseName = LIBRARYSERVICES_REPORT_PATH
Data8.DatabaseName = LIBRARYSERVICES_REPORT_PATH
Select Case giSearch
Case 1
SearchFrame(0).Visible = True
MSFlexGrid1.Visible = True
Data1.Visible = True
Data1.Refresh
SetRecordNumber1
Case 2
SearchFrame(1).Visible = True
MSFlexGrid2.Visible = True
Data2.Visible = True
Data2.Refresh
SetRecordNumber2
Case 3
SearchFrame(2).Visible = True
MSFlexGrid1.Visible = True
Data1.Visible = True
Data1.Refresh
SetRecordNumber1
Case 4
SearchFrame(3).Visible = True
MSFlexGrid3.Visible = True
Data3.Visible = True
Data3.Refresh
SetRecordNumber3
Case 5
SearchFrame(4).Visible = True
MSFlexGrid1.Visible = True
Data1.Visible = True
Data1.Refresh
SetRecordNumber1
Case 6
SearchFrame(5).Visible = True
MSFlexGrid1.Visible = True
Data1.Visible = True
Data1.Refresh
SetRecordNumber1
Case 7
SearchFrame(6).Visible = True
MSFlexGrid4.Visible = True
Data4.Visible = True
Data4.Refresh
SetRecordNumber4
End Select
Form_Load_Exit:
Exit Sub
Error:
MsgBox "Problem Accessing Data File Please locate data file.", vbExclamation, "Error Condition database not found [Form_Load]"
Unload frmSearchList
End Sub
Private Sub Data1_Reposition()
Screen.MousePointer = vbDefault
On Error Resume Next
'This will display the current record position
'for dynasets and snapshots
SetRecordNumber1
'for the table object you must set the index property when
'the recordset gets created and use the following line
'Data1.Caption = "Record: " & (Data1.Recordset.RecordCount * (Data1.Recordset.PercentPosition * 0.01)) + 1
End Sub
Private Sub SetRecordNumber1()
Dim iRecordCount As Integer
Dim icurrentRecord As Integer
iRecordCount = Data1.Recordset.RecordCount
icurrentRecord = Data1.Recordset.AbsolutePosition + 1
If Data1.Recordset.EOF Then
Data1.Caption = "EOF"
Else
Data1.Caption = "Record " & icurrentRecord & " of " & iRecordCount
End If
End Sub
Private Sub Data2_Reposition()
Screen.MousePointer = vbDefault
On Error Resume Next
'This will display the current record position
'for dynasets and snapshots
SetRecordNumber2
'for the table object you must set the index property when
'the recordset gets created and use the following line
...
read more »