|
-
Dec 16th, 2005, 11:44 PM
#1
Thread Starter
Member
Database.SetDataSource Unbound fields
I am very new to Crystal Reports and having problems to use it,
My Setup
1. Using VB 6
2. Crystal Report 9
3. Designing reports in VB using DSR
Actually I have few questions....
Q1. I have IFieldObject filed which, I set property "RightLineStyle - 1" and "BottomLineStyle - 2". Problem is that when this filed contains "" value, it dose not display LINES. Is I missed any property to SET to override this behaviour?
What I already done to avoid it, I write code
Code:
IIf(Len(`tablename`.`filedname1`) = 0, ' - NIL - ', tablename`.`fieldname1`)
But I can not do this at every place, i have to print " " (space) on the report.
Any Idea?
Q2. Actually this problems arises when I am unable to produce record set through one Query (Due to some complex database setup/structure).
For example I have Following Data, how i can print this on the report?
Report is not attached/connected with any table
FIVE unbound fileds on the report
CModalChargesInfo is Class object
VB Code:
Dim infoChargesArray() As CModalChargesInfo
ReDim infoChargesArray(3)
Set infoChargesArray(1) = New CModalChargesInfo
Set infoChargesArray(2) = New CModalChargesInfo
Set infoChargesArray(3) = New CModalChargesInfo
infoChargesArray(1).strVIA = "Data Row 1 - VIA"
infoChargesArray(1).dCharges = 200
infoChargesArray(1).strName = "Data Row 1 - Shipped"
infoChargesArray(1).strID = "Data Row 1 - ID"
infoChargesArray(1).dtDate = Now
infoChargesArray(2).strVIA = "Data Row 1 - VIA"
infoChargesArray(2).dCharges = 200
infoChargesArray(2).strName = "Data Row 1 - Shipped"
infoChargesArray(2).strID = "Data Row 1 - ID"
infoChargesArray(2).dtDate = Now
infoChargesArray(3).strVIA = "Data Row 1 - VIA"
infoChargesArray(3).dCharges = 200
infoChargesArray(3).strName = "Data Row 1 - Shipped"
infoChargesArray(3).strID = "Data Row 1 - ID"
infoChargesArray(3).dtDate = Now
m_Report.Database.SetDataSource (infoChargesArray())
With m_Report
.UnboundString1.SetUnboundFieldSource "infoChargesArray.strVIA"
.UnboundCurrency1.SetUnboundFieldSource "{infoChargesArray.dCharges}"
.UnboundString2.SetUnboundFieldSource "{infoChargesArray.strName}"
.UnboundString3.SetUnboundFieldSource "{infoChargesArray.strID}"
.UnboundDate1.SetUnboundFieldSource "{infoChargesArray.dtDate}"
End With
I try to do this way, but it is not working .....
Q3. I try accomplish same concept with some overload on system (creating Recordset through array),
VB Code:
Dim ary(5) As String
Dim s As String
Dim rs As New ADODB.Recordset
Dim i As Integer
ary(0) = "VBForums"
ary(1) = "Crystal Reports"
ary(2) = "Urgent"
ary(3) = "Very Urgent"
ary(4) = "Problem"
rs.Fields.Append "Name", adVarChar, 20
rs.Open
For i = i To 5
rs.AddNew
rs!Name = ary(i)
rs.Update
Next
Report.Database.SetDataSource rs 'THROWING EXCEPTION on this line(Subscript out of range) run-time error '9'
Report.UnboundString1.SetUnboundFieldSource "Name"
CRViewer91.ReportSource = Report
CRViewer91.ViewReport
But this code producing runtime error, I also try Report.Database.SetDataSource rs, 3, 1 (I saw some where on the forum)
Report.Database.SetDataSource rs, 1, 3 (I saw some where on the forum)
but both are not working.....
HELP ME!!!
I already spend alot of time to solve these problems.... but they are still on the same level.
Thanks in advance to all
Last edited by si_the_geek; Dec 17th, 2005 at 02:45 PM.
Reason: added Code/VBCode tags
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|