增加打印报告中的字段值

时间:2015-07-07 04:16:32

标签: report

先生/妈妈,我想在打印访问报告时增加字段值

ex:字段值使用数字1和2分为3和4用于下一页打印,现在我正在使用此代码打印表单上字段值的页数

Private Sub cmdprint_Click()
On Error GoTo Err_cmdprint_Click

Dim strWhere As String

If Me.Dirty Then    'Save any edits.
    Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
    MsgBox "Select a record to print"
Else
    strWhere = "[NomorUrut] = " & Me.[NomorUrut]
    DoCmd.OpenReport "SPK", acViewPreview, , strWhere
    'create the message box
    Dim prnt As Integer
    'PRNT = MsgBox("Print" & "[Forms]![ScheduleNC Query1]![prnt].Value" & " Labels?", vbQuestion + vbYesNo + vbDefaultButton1, "Question")
    prnt = MsgBox("Print?", vbQuestion + vbYesNo + vbDefaultButton1, "Question")

    If prnt = vbYes Then
        DoCmd.PrintOut , , , , [Forms]![ScheduleNC Query1]![prnt].Value

        DoCmd.Close
    Else
    DoCmd.Close
    End If
End If

'DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
'DoCmd.PrintOut acSelection, , , , [Forms]![ScheduleNC Query1]![PRNT].Value

Exit_cmdprint_Click:
    Exit Sub

Err_cmdprint_Click:
    MsgBox Err.Description
    Resume Exit_cmdprint_Click

End Sub

有人帮帮我..谢谢你的关注和回复...... 尝试使用[页面],但我的第一页是2列,所以第一页中的数字1和2

0 个答案:

没有答案