Office中国论坛/Access中国论坛

标题: 又是一個報表問題 [打印本页]

作者: be    时间: 2005-3-18 00:18
标题: 又是一個報表問題
我在網上下了一個 Function 來改。

想問一下﹕如果記錄為24或25條時(我設定滿25條記錄換頁﹐每頁不夠25條記錄則補滿25條)為何最后一條記錄會重復多輸出一次﹖

Global TotCount As Integer  '當前行



      Function PrintLines(R As Report, TotGrp)

         Dim Rnd As Long    '定義行數

         Dim Pg As Long     '定義頁數

         Const cln = 25     '設定每頁行數

         Pg = Fix((TotGrp - 1) / cln) + 1   '設定打印頁數

         Rnd = 25 * Pg    '設定打印行數

         

         TotCount = TotCount + 1    '記錄行數加1

         If TotCount = TotGrp Then   '如果當前行等于記錄數

              R.NextRecord = False

         ElseIf TotCount > TotGrp And TotCount < Rnd Then   '不足整頁則打印空白行

              R.NextRecord = False

              R![tab_id].Visible = False

              R![wage_staff_name].Visible = False

              R![wage_post_name].Visible = False

              R![wage_w_Base].Visible = False

              R![wage_w_Turnover].Visible = False

              R![wage_w_Bonus].Visible = False

              R![wage_w_Post].Visible = False

              R![wage_w_Level].Visible = False

              R![wage_w_Outside].Visible = False

              R![Text55].Visible = False

              R![wage_w_Cura].Visible = False

              R![wage_w_Board].Visible = False

              R![wage_w_Drink].Visible = False

              R![wage_w_Snack].Visible = False

              R![wage_w_Tel].Visible = False

              R![wage_w_Car].Visible = False

              R![wage_w_Mini].Visible = False

              R![wage_w_GetMail].Visible = False

              R![wage_w_SendMail].Visible = False

              R![wage_w_Premium].Visible = False

              R![wage_w_Other].Visible = False

              R![Text66].Visible = False

              R![wage_c_Leave].Visible = False

              R![wage_c_Gowrong].Visible = False

              R![wage_c_Insu].Visible = False

              R![wage_c_Board].Visible = False

              R![wage_c_Other].Visible = False

              R![Text67].Visible = False

              R![Text69].Visible = False

              R![Text181].Visible = False

            

         End If

       End Function




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3