A personal repository of random information in compensation for a fatigued biological computer
Breaded IT » MS Access / SQL Server reminders » Access Report Writer
Remember to do Force new Page on Group FOOTERS
If using Detail_form or detail_print, wrap it in a record check in case there are no records..
Private Sub Detail_Print(Cancel As Integer, FormatCount As Integer)
' Check for Archway match
If Me.CurrentRecord <> 0 Then
If Not AccessionNumber = "" Then
AccessionNameToDisplay = GetAccessionFromArchway(AccessionNumber)
Else
AccessionNameToDisplay = ""
End If
If Not IsNull(AgencyCode) And Not AgencyCode = "" Then
AgencyNameToDisplay = GetAgencyCodeFromArchway(AgencyCode)
Else
AgencyNameToDisplay = ""
End If
'If Not IsNull(SeriesNumberControl) = "" Then
If SeriesNumber <> "" Then
SeriesNameToDisplay = GetSeriesNumberFromArchway(SeriesNumber)
Else
SeriesNameToDisplay = ""
End If
End If
End Sub
Duplex:
In designer do page setup, select a specific printer & duplex, save, then select the default printer again.
Havent used this:
http://www.tech-archive.net/Archive/VB/microsoft.public.vb.winapi/2005-11/msg00056.html
Format | A series | B series | C series | |||
---|---|---|---|---|---|---|
Size | mm × mm | in × in | mm × mm | in × in | mm × mm | in × in |
0 | 841 × 1189 | 33.1 × 46.8 | 1000 × 1414 | 39.4 × 55.7 | 917 × 1297 | 36.1 × 51.1 |
1 | 594 × 841 | 23.4 × 33.1 | 707 × 1000 | 27.8 × 39.4 | 648 × 917 | 25.5 × 36.1 |
2 | 420 × 594 | 16.5 × 23.4 | 500 × 707 | 19.7 × 27.8 | 458 × 648 | 18.0 × 25.5 |
3 | 297 × 420 | 11.7 × 16.5 | 353 × 500 | 13.9 × 19.7 | 324 × 458 | 12.8 × 18.0 |
4 | 210 × 297 | 8.3 × 11.7 | 250 × 353 | 9.8 × 13.9 | 228 × 324 | 9.0 × 12.8 |
5 | 148.5 × 210 | 5.8 × 8.3 | 176 × 250 | 6.9 × 9.8 | 162 × 229 | 6.4 × 9.0 |
6 | 105 × 148.5 | 4.1 × 5.8 | 125 × 176 | 4.9 × 6.9 | 114 × 162 | 4.5 × 6.4 |
7 | 74 × 105 | 2.9 × 4.1 | 88 × 125 | 3.5 × 4.9 | 81 × 114.9 | 3.2 × 4.5 |
8 | 52 × 74 | 2.0 × 2.9 | 62 × 88 | 2.4 × 3.5 | 57 × 81 | 2.2 × 3.2 |
9 | 37 × 52 | 1.5 × 2.0 | 44 × 62 | 1.7 × 2.4 | 40 × 57 | 1.6 × 2.2 |
10 | 26 × 37 | 1.0 × 1.5 | 31 × 44 | 1.2 × 1.7 | 28 × 40 | 1.1 × 1.6 |
Private Sub cmdPRINTRec_Click()
'****************************************************
' PRINT Displayed Record. PRINT Record Button.
On Error GoTo Err_Handler:
DoCmd.OpenReport "REPORTNAME", acViewPreview, , "SICKID = " &
Me.SICKID
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, "REPORTNAME", acSaveNo
Me.Refresh
DoCmd.Hourglass (True)
Exit_Point:
DoCmd.Hourglass (False)
Exit Sub
Err_Handler:
DoCmd.Close acReport, "REPORTNAME", acSaveNo
DoCmd.Hourglass (False)
Select Case Err
Case 2212
MsgBox "Cannot Print Now.":
Resume Exit_Point
Case 2501
'MsgBox "Print Has Been Cancelled.":
Resume Exit_Point
Case Else
Resume Exit_Point
End Select
End Sub
To trap the error, you need to set up an error handler.
Public Function PrintAccess()
On Error GoTo CheckError
DoCmd.RunCommand (acCmdPrint)
ExitHere:
Exit Function
CheckError:
If Err.Number = 2501 Then Resume ExitHere
Msgbox Err.Description & vbCrLf & "Error # " & Err.Number, vbOkOnly +
vbCritical, "Error in PrintAccess"
End Function
docmd.RunCommand acCmdPrint
You can also use the following to create a function which then can be caled in the
OnAction of the toolbar's Print button as &H3DPrintMenu() with the equal sgn:
Public Function PrintMenu() ' brings up print dialog box when called by oaction of
'print button. Put this function in a module
On Error GoTo HandleErr
'RunCommand acCmdPrint
DoCmd.RunCommand acCmdPrint
ExitHere:
Exit Function
HandleErr:
Select Case Err.Number
Case 2501
' cancelled by user
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritica,
"modMiscProcs.PrintMenu"
End Select
' End Error handling block.
End Function
Private Sub EntryNumberHeader_Format(Cancel As Integer, FormatCount As Integer)
If Me.HasData Then Me.EntryNumberHeader.Visible = True Else Me.EntryNumberHeader.Visible = False
End Sub