Set Report = New CrystalReport3 '重新设一下
CRViewer1.ReportSource = Report
CRViewer1.ViewReport '预览报表
Dim j As Integer ' j 循环写入的变量
Dim strn As Integer
While StrWidth(j, 0) <> ""
strn = StrWidth(j, 0)
Call Refresh1(strn, j) '此处就是重新设每个控件的位置
j = j + 1
Wend
Exit Sub
Else
Exit Sub
End If
End If
Next
End If
CRViewer1.Refresh ''''出错处
改为:
Set Report = New CrystalReport3 '重新设一
Dim j As Integer ' j 循环写入的变量
Dim strn As Integer
While StrWidth(j, 0) <> ""
strn = StrWidth(j, 0)
Call Refresh1(strn, j) '此处就是重新设每个控件的位置
j = j + 1
Wend
Exit Sub
Else
Exit Sub
End If
End If
Next
CRViewer1.ReportSource = Report
CRViewer1.ViewReport '预览报表
End If
因为你CRViewer1.ViewReport 时,CRViewer1正在下载数据,
而程序接着往下执行,当执行到CRViewer1.Refresh时数据还未下载好所以会出错!
If str(n) = True Then '
—————————————————————————————— 中间这都是计算位置的
Dim i As Integer
Dim x As Integer
For i = 0 To UBound(StrWidth) 'i 查找位置的变量
If Val(StrWidth(i, 0)) = n Then
If StrWidth(i, 3) <> Txtname.Text Or StrWidth(i, 2) <> TxtWidth.Text * 100 Then
x = i
StrWidth(x, 0) = n
'StrWidth(x, 1) = IntLeft 起始位置不变
StrWidth(x, 2) = TxtWidth.Text * 100
StrWidth(x, 3) = Txtname.Text
For x = x + 1 To UBound(StrWidth)
If StrWidth(x, 0) = "" Then
IntLeft = StrWidth(x - 1, 1) + StrWidth(x - 1, 2) + 100
Exit For
End If
StrWidth(x, 1) = StrWidth(x - 1, 1) + StrWidth(x - 1, 2) + 100
Next
————————————————————————————————————————
Set Report = New CrystalReport3 '重新设一下
CRViewer1.ReportSource = Report
CRViewer1.ViewReport '预览报表
Dim j As Integer ' j 循环写入的变量
Dim strn As Integer
While StrWidth(j, 0) <> ""
strn = StrWidth(j, 0)
Call Refresh1(strn, j) '此处就是重新设每个控件的位置
j = j + 1
Wend
Exit Sub
Else
Exit Sub
End If
End If
Next
End If
CRViewer1.Refresh ''''出错处
End If