p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

crystal_reports thread: Setting up a simple Crystal Report


Message #1 by "Enzo Zaragoza" <enzaux@g...> on Sat, 9 Nov 2002 17:47:31 +0800
	Hello!  I'm really having a hard time using Crystal Report 8.5. It's way too complicated
that I could not show the things that I want to be in the report.  Here are SOME problems
I'm encountering with:

1.)  I cannot set a integer field to something like 00001 or TN-00001 
2.)  I cannot set the field to be in all UPPER CASE
3.)  I cannot set the query wherein I could base the report
4.)  Following the sample provided with seagate about the use of ADO coding to 
     set the datasource of report...well no luck I can't make it to work.  Actually
     the report is showing but not reflecting the query I have done in the code.
5.)  If I set the database password, everytime I access the report it keeps prompting me
     the Data Link Properties window so that I'll have to put the password again.

	How can I really set my report somehow similar to Access wherein I will based it in
query then when opening a report I could filter the report again? for ex:

"Report1 is based on qryPayments(all customer payments).  frmPayments will show frmReport
that will show Report1 thru CRViewer.  On frmPayments the user can select which customer
he/she wants to see the report.  If the user selects Customer1 only payments made by 
Customer1 will be shown in the report. In Access I use to do it like this:

 DoCmd.OpenReport "Report1", acViewPreview, ,"AgentID=" & cboAgents.Value
"

	This sounds may be easy but I really don't have any idea how to do it I have tried
but I have failed I can't make the report show what I want to.  I guess this is the cause
of being an Access fanatic.


Below is my code:
~~~~~~~~~~~~~~~~~~~~     
Option Explicit

Dim db As New ADODB.Connection
 Dim rs As New ADODB.Recordset
 Dim strSQL As String
 Dim Report As New rptPaymentsNBalances3

Private Sub Form_Load()

 strSQL = "SELECT " & _
              "tblAgents.AgentID, tblAgents.AgentName, tblAgents.AgentType, " & _
              "tblCargoBills.BillNo, tblCargoBills.MAWBNO, tblCargoBills.Amount, " & _
              "tblCargoPayments.TranNo, tblCargoPayments.Amount " & _
          "FROM " & _
              "(tblAgents INNER JOIN tblCargoBills ON tblAgents.AgentID = " & _
              "tblCargoBills.AgentID) INNER JOIN tblCargoPayments on tblCargoBills.Billno=" & _
              "tblCargoPayments.BillNo " & _
          "WHERE " & _
              "tblCargoBills.Posted = True AND tblCargoBills.Cancelled = False AND " & _
              "tblCargoPayments.Cancelled = False"


  db.Open CONNSTR
  rs.Open strSQL, db, adOpenStatic, adLockReadOnly

Report.Database.SetDataSource rs
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
CRViewer1.Zoom 100
CRViewer1.ViewReport
Screen.MousePointer = vbDefault

End Sub		
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Thanks,


Enzo
YahooID: yackydidakdak

Message #2 by "Wong Tze Lun" <tzelun0502@l...> on Sun, 10 Nov 2002 04:14:37 +0700
Hi Enzo,
 It seem every coding u put in there should be well provide the data for your is your report have the saving data during design the
report try use the discardsavedata method. I think using the crviewer have alot of feature which u might not yet discover it is a
very powerful tools for reporting.

regards
tl wong


__________________________________________________________
Outgrown your current e-mail service? Get 25MB Storage, POP3 Access,
Advanced Spam protection with LYCOS MAIL PLUS.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus

  Return to Index