A warning/confirmation message for user before printing??

swift

Registered User.
Local time
Today, 04:44
Joined
Mar 12, 2006
Messages
67
Hi all,

I am building a simple db from scratch using the limited knowledge i have, and a lot of the information gained from searching these forums as a guest. I've now reached a point where I can't seem to find what I'm looking for, so any help would be gratefully received!!

I have a single table, single form and single report (told you it was simple;)). The table has nearly 2000 records and 2000 pictures (linked). On the form I can print every record with a single click of a command button. This is great, but I would like a message box to popup and confirm the print action, as this is gonna be expensive if its clicked on every record!!

If anybody can help, I would be chuffed!! I searched the forums and can't seem to find anything on this!!

j
 
Put a MsgBox warning in your code and don't print unless = vbYes. Use VBA help on the message box (MsgBox) and post back here if you still have trouble.
 
Put this in the On Page event of your report(s):

Code:
Dim intTotalPages As Integer, strMsg As String

intTotalPages = Me.Pages

If intTotalPages > 1 Then


    strMsg = "This report contains " & intTotalPages & " pages." _
    & Chr(13) & Chr(10) _
    & "Do you wish to continue?"

If MsgBox(strMsg, vbYesNo) = vbNo Then


    DoCmd.Close acReport, Me.Name

Else
End If
Exit Sub
End If

It can be used with either print or preview. The number of pages before the code fires can be set here:
Code:
If intTotalPages > 1
 

Users who are viewing this thread

Back
Top Bottom