★★★快来抢50分★★★:如何限制datareport一页只显示8条记录??

deak 2002-01-31 05:38:17
...全文
218 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
smartdx 2002-02-01
  • 打赏
  • 举报
回复
Random(随便) (2002-1-31 17:57:31)
控制页眉、页身、页尾的高度使之正好打八条记录,需要不断测试调整

可以的,我就是这么实现的!
报表头、报表尾为空,页眉、页角用做报表头、报表尾!
playyuer 2002-02-01
  • 打赏
  • 举报
回复
Me.Sections.Item("SectionX").Height = 8 * Me.Sections.Item("SectionX").Controls.Item("TextX").Height
'SectionX 为 Detail 区
hzyzx 2002-02-01
  • 打赏
  • 举报
回复
用代码控制主体里用来显示记录数据的控件的高度,使它刚好每页显示8条。
deak 2002-02-01
  • 打赏
  • 举报
回复
难道dataport就没有解决的办法?
这是最基本的需求!
jamex 2002-02-01
  • 打赏
  • 举报
回复
http://www.dapha.net/vb/list.asp?id=1454
cxj1 2002-02-01
  • 打赏
  • 举报
回复
!
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

rs.Open sql, Cn, adOpenStatic, adLockOptimistic
rs.PageSize = 5

DataReport1.Sections(3).Controls(1).DataField = "namesc"
DataReport1.Sections(3).Controls(2).DataField = "dialcode"
DataReport1.Sections(3).Controls(3).DataField = "Points"

Set DataReport1.DataSource = rs


DataReport1.Sections(2).Controls(5).Caption = xname & "市通话报表"

End Sub
deak 2002-02-01
  • 打赏
  • 举报
回复
我的意思是每页显示8条记录!!!
lihonggen0 2002-02-01
  • 打赏
  • 举报
回复
'我以前做的,每页也打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

Unload Me
End Sub
deak 2002-02-01
  • 打赏
  • 举报
回复
??
chsl918 2002-02-01
  • 打赏
  • 举报
回复
最最直接麻烦的方式就是建立打印临时表。把你要打的8条放入表中,用后再进行删除。
或者你可以试一试用sql语句进行限制:
在where中加入 rownum =8 就可以了 这个SQL语句在Oracle中没有问题的。
select c1,c2 from tablename where rownum=8
gongwen 2002-02-01
  • 打赏
  • 举报
回复
关注
deak 2002-02-01
  • 打赏
  • 举报
回复
??
hufei00 2002-01-31
  • 打赏
  • 举报
回复
关注
shawls 2002-01-31
  • 打赏
  • 举报
回复
///////////////////////////////////////////////////
///.......////////......./////...............//////
///.......////////......./////.................////
///.......////////......./////..................///
///.......////////......./////..................///
///.......////////......./////...................//
///.......////////......./////.......////........//
///.......////////......./////......./////.......//
///.......////////......./////......./////.......//
///.......////////......./////......./////.......//
///.......////////......./////.......////........//
///.......////////......./////...................//
///.......////////......./////..................///
///.......////////......./////.................////
///.......////////......./////................/////
///.......////////......./////..............///////
///.......////////......./////.......//////////////
///........//////......../////.......//////////////
////........////........//////.......//////////////
////....................//////.......//////////////
/////..................///////.......//////////////
//////................////////.......//////////////
///////............../////////.......//////////////
/////////..........///////////.......//////////////
///////////////////////////////////////////////////
///////////////////////////////////////////////////
cmt123 2002-01-31
  • 打赏
  • 举报
回复
关注!
deak 2002-01-31
  • 打赏
  • 举报
回复
to Random:
那样调整不行,我试过
thank you
deak 2002-01-31
  • 打赏
  • 举报
回复
to donotbesilent:
我是要每页显示8条记录,记录集肯定不止8条记录

附:
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

rs.Open sql, Cn, adOpenStatic, adLockOptimistic
rs.PageSize = 5

DataReport1.Sections(3).Controls(1).DataField = "namesc"
DataReport1.Sections(3).Controls(2).DataField = "dialcode"
DataReport1.Sections(3).Controls(3).DataField = "Points"

Set DataReport1.DataSource = rs


DataReport1.Sections(2).Controls(5).Caption = xname & "市通话报表"

End Sub
设置rs.PageSize = 5不起作用
Random 2002-01-31
  • 打赏
  • 举报
回复
控制页眉、页身、页尾的高度使之正好打八条记录,需要不断测试调整
donotbesilent 2002-01-31
  • 打赏
  • 举报
回复
记录集只选择8条记录不就得了吗?
deak 2002-01-31
  • 打赏
  • 举报
回复
??

742

社区成员

发帖
与我相关
我的任务
社区描述
VB 版八卦、闲侃,联络感情地盘,禁广告帖、作业帖
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧