!
Private Sub DataReport_Initialize()
Dim m As Integer
Dim sql As String
Dim rs As New ADODB.Recordset
m = Len(xcity)
If Left(xcity, 1) = 0 Then
sql = "select namesc,dialcode,sum(usedpoints) Points from cdr1 where left(dialcode," & m + 1 & ")='86" & Mid(xcity, 2, m) & "' group by dialcode,namesc"
Else
sql = "select namesc,dialcode,sum(usedpoints) Points from cdr1 where left(dialcode," & m + 1 & ")='86" & Mid(xcity, 2, m) & "' group by dialcode,namesc"
End If
'我以前做的,每页也打8条
'思路:不到8条添空记录,(注意:不是在数据库里加)
Private Sub sscmdOK_Click(Index As Integer)
Dim sqlprint As String
Dim nRecordCount As Integer
Dim iAddnew As Integer
Dr_J_Rktzd.Sections(4).Controls("label40").Caption = W_J_Rktzd.Label1(19).Caption
sqlprint = "SELECT * FROM J_Rktzd_sp WHERE RKdh='" & Trim(W_J_Rktzd.Text1(10).Text) & "' order by id "
If DE_Report.rsCom_J_Rktzd.State = adStateOpen Then
DE_Report.rsCom_J_Rktzd.Close
End If
DE_Report.rsCom_J_Rktzd.LockType = adLockBatchOptimistic
DE_Report.rsCom_J_Rktzd.Open sqlprint
nRecordCount = DE_Report.rsCom_J_Rktzd.RecordCount
If nRecordCount < 8 Then
For iAddnew = 1 To 8 - nRecordCount
DE_Report.rsCom_J_Rktzd.AddNew
Next
Else
If nRecordCount > 8 Then
If Int(nRecordCount / 8) <> nRecordCount / 8 Then
For iAddnew = 1 To 8 - (nRecordCount - Int(nRecordCount / 8) * 8)
DE_Report.rsCom_J_Rktzd.AddNew
Next
End If
End If
End If
ReportPrint "com_J_Rktzd", sqlprint, Dr_J_Rktzd
'报表赋值
Call Rktzd_Report_GetLable
'设置纸张 为 A4 纵向
' SetDefaultPrinterOrientation 1, 9
If SSOption1(1).Value = True Then
Dr_J_Rktzd.Sections(3).Controls("txtJE").Visible = True
Else
Dr_J_Rktzd.Sections(3).Controls("txtJE").Visible = False
End If
Dr_J_Rktzd.Show 1
附:
Private Sub DataReport_Initialize()
Dim m As Integer
Dim sql As String
Dim rs As New ADODB.Recordset
m = Len(xcity)
If Left(xcity, 1) = 0 Then
sql = "select namesc,dialcode,sum(usedpoints) Points from cdr1 where left(dialcode," & m + 1 & ")='86" & Mid(xcity, 2, m) & "' group by dialcode,namesc"
Else
sql = "select namesc,dialcode,sum(usedpoints) Points from cdr1 where left(dialcode," & m + 1 & ")='86" & Mid(xcity, 2, m) & "' group by dialcode,namesc"
End If