View Full Version : printin reports with a pause


abenitez77
10-11-2010, 04:38 AM
I have some code that i use to print (http://www.tek-tips.com/viewthread.cfm?qid=1623264&page=1#) a report and after the report it goes out to print a tif image with a 3rd part exe. The tif image is being printed across the internet so it could take a few seconds or 2 or 3 minutes...depending on the size of the image. The report has multiple records and it prints 1 record then the tif image(s) then loops back and goes to record 2 and the tif images that goes with it. How do i get it to pause and wait till it is finished printing that tif image before it goes and prints the next record of the ms report?

My code (http://www.tek-tips.com/viewthread.cfm?qid=1623264&page=1#):
Private Sub Print_Click()

Dim rst As Recordset
Dim db As Database (http://www.tek-tips.com/viewthread.cfm?qid=1623264&page=1#)
Dim temp As String
Dim svrname As String

Set db = CurrentDb
Set rst = db.OpenRecordset("imagepaths", dbOpenDynaset)

svrname = fOSMachineName

If rst.EOF = True And rst.BOF = True Then
Exit Sub
Else
rst.MoveLast
rst.MoveFirst
temp = "0"

Do Until rst.EOF = True

If temp <> rst![CLAIMNO] Then
DoCmd.OpenReport "Claim_Assembler1", acViewNormal, , "[CLAIMNO2]=" & rst![CLAIMNO2]
Delay 5
End If



If Right(LTrim(RTrim(rst![IMAGEPATH])), 3) = "TIF" Or Right(LTrim(RTrim(rst![IMAGEPATH])), 3) = "JPG" Then
'usbPrintFile rst![ImagePath]
ShellandWait ("\\" & svrname & "\Imdex\ImdexPrintFitPageLandscape.exe " & rst![IMAGEPATH])
'Delay 3
End If

temp = rst![CLAIMNO]

rst.MoveNext

Loop

End If
End Sub