0
votes

im working on project which require crystal report 9 and vb6.

i created a crystal report page an selected all columns i want .

then in form user select the data by this code

If frmRepTabaee1.Check1.Value = 1 And frmRepTabaee1.chbTamin.Value = 1 Then
     If frmRepTabaee1.txtTabai.Text = 1 Then
       sqlStr = "select pcode,name,lastname,TTaminDarman1,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"

       ElseIf frmRepTabaee1.txtTabai.Text = 2 Then
            sqlStr = "select pcode,name,lastname,TTaminDarman2,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"

       ElseIf frmRepTabaee1.txtTabai.Text = 3 Then
       sqlStr = "select pcode,name,lastname,TTaminDarman3,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"

       ElseIf frmRepTabaee1.txtTabai.Text = 4 Then
       sqlStr = "select pcode,name,lastname,TTaminDarman4,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"

       ElseIf frmRepTabaee1.txtTabai.Text = 5 Then
       sqlStr = "select pcode,name,lastname,TTaminDarman5,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"
              ElseIf frmRepTabaee1.txtTabai.Text = 6 Then
       sqlStr = "select pcode,name,lastname,TTaminDarman6,y,mon from tbllisthogh" & frmRepTabaee1.txty & "" & frmRepTabaee1.txtmon & " where typepar= 'ÍÞæÞ'  and idvoras = '0'  order by convert(int,pcode )"

    End If
End If

Screen.MousePointer = vbHourglass

rs.Open sqlStr, cn


Report.Database.SetDataSource rs, , 1

'--------------------------------
'''''''''''''''''''''''''''''''''

'''''''''''''''''''''
'-------------------
CRViewer91.Refresh
'-------------------

CRViewer91.ReportSource = Report
CRViewer91.ViewReport
Screen.MousePointer = vbDefault
'End If
End Sub

Problem :

when sql query use diffrent columns to be select and that cuse the null problem in crystal report 9 , how can i set default value for null ?

in vb6& crystal report 9

thanks

1

1 Answers

0
votes

I don't have version 9, but somewhere in Crystal Reports general settings for the report options you should have checkboxes for Convert Database NULL Values to Default and Convert Other NULL Values to Default. Checking those should eliminate your errors.enter image description here