Options for checking if report printed correctly?

Garindan

Registered User.
Local time
Today, 08:49
Joined
May 25, 2004
Messages
250
Hi all, I have a form where users select multiple records to print using a check box, then click on a command button to open the report in print preview. This then requeries the form and removes the selected records (because they have been printed).

When testing I found that if a user selects records, hits print, then selects more records and hits print again... the second time the report opens in print preview it will replace the first instance of the report. If the first instance of the report was not printed by accident, it has now been replaced, and the records have been removed from the form.

So I need to code the report to prevent this scenario happening and was wondering what the best way to do it might be?

If I added a message box to the reports on close event to check whether it was printed correctly with Ok/Cancel, what would happen when a user tries to open a second report and the first hasn't closed? What would happen if the user selects cancel? Presumably the records would still have been removed from the form? This is where I'm unsure and thought I'd ask for some advice :o

Here's the code I currently have in the forms command button to open the report...
Code:
Private Sub btnOpenDelivRpt_Click()

    ' Force any unsaved changes
    If Me.Dirty Then
    Me.Dirty = False
    End If
            
    If Nz(Me!txtSelected, 0) = 0 Then
        MsgBox "Please select an Order to print", vbOKOnly, "Error"
    Else
        If MsgBox("Please make sure the right Orders have been selected. This will open delivery sheet and remove orders from form. Continue?", vbOKCancel, "Warning") = vbOK Then
            
            DoEvents
            
            DoCmd.OpenReport "rptOrderDeliveries", acViewPreview
            
            CurrentDb.Execute "UPDATE qselUnprocessedOrders SET qselUnprocessedOrders.Processed = Yes WHERE (((qselUnprocessedOrders.Delivered)=Yes));"
            
            ' Requery the subform
            Me.fsubUnprocessedOrders.Requery
    
        End If
    End If
End Sub
The report currently has no code.
Thanks in advance for any help!
 

Users who are viewing this thread

Back
Top Bottom