D
DS
I would like to run this code from a recordset.
Any help would be most greatly appreciated.
Thanks
DS
Dim PO As Integer
Dim EMPTI As Integer
Me.TxtNumber = Nz(DMax("PDPrinterID", "tblPrintDetails", "PDCheckID = "
& Me.TxtCheckID), 0)
For PO = 0 To Nz(Me.TxtNumber - 1, 0)
Me.TxtName = Nz(DLookup("PrinterName", "tblPrinters", "PrinterID = " &
Me.TxtNumber), "")
If IsNull(Me.TxtName) Or _
Me.TxtName = "" Then
Me.TxtName = ""
Else:
Set Application.Printer = Application.Printers(Me.TxtName.Value)
DoCmd.OpenReport "rptPrepSlip", , , "PDCheckID = " &
Me.TxtCheckID & " " & _
"And PDPrinterID = " & Me.TxtNumber & ""
Me.TxtNumber = Me.TxtNumber - 1
EMPTI = Nz(DCount("PDPrinterID", "tblPrintDetails", "PDPrinterID =
" & Me.TxtNumber & "AND PDCheckID = " & Me.TxtCheckID), 0)
If IsNull(EMPTI) Or _
EMPTI = 0 Then
Me.TxtNumber = Me.TxtNumber - 1
Else:
End If
Set Application.Printer = Nothing
End If
Next PO
Any help would be most greatly appreciated.
Thanks
DS
Dim PO As Integer
Dim EMPTI As Integer
Me.TxtNumber = Nz(DMax("PDPrinterID", "tblPrintDetails", "PDCheckID = "
& Me.TxtCheckID), 0)
For PO = 0 To Nz(Me.TxtNumber - 1, 0)
Me.TxtName = Nz(DLookup("PrinterName", "tblPrinters", "PrinterID = " &
Me.TxtNumber), "")
If IsNull(Me.TxtName) Or _
Me.TxtName = "" Then
Me.TxtName = ""
Else:
Set Application.Printer = Application.Printers(Me.TxtName.Value)
DoCmd.OpenReport "rptPrepSlip", , , "PDCheckID = " &
Me.TxtCheckID & " " & _
"And PDPrinterID = " & Me.TxtNumber & ""
Me.TxtNumber = Me.TxtNumber - 1
EMPTI = Nz(DCount("PDPrinterID", "tblPrintDetails", "PDPrinterID =
" & Me.TxtNumber & "AND PDCheckID = " & Me.TxtCheckID), 0)
If IsNull(EMPTI) Or _
EMPTI = 0 Then
Me.TxtNumber = Me.TxtNumber - 1
Else:
End If
Set Application.Printer = Nothing
End If
Next PO