Hello,
I am running Access 07 and I am having a problem with my printing that is just baffling me.
I have a form that is used to view which items have been added to a que to receive a barcode. Here, quantities can be changed regarding how many of each item are without barcodes and items can also be removed.
When the user Clicks a "Print All" control the form feeds the first item in the que into a report, the report grabs the items barcode and prints through our barcode printer.
If the quantity is greater than 1 it repeats for whatever the quantity is, then when the quantity has been satisfied it moves on to a delete query that removes this item from the que.
The form moves through the entire table this way. Everything works fine accept I have an anomaly I can't put my finger on, for some reason it will print out of order and even though I've que'd the same items in the same way multiple times for testing it will sometimes work and then sometimes print out of order. It does not maintain consistency in that the same one is out of order all the time, it changes. The only consistency is that it is only 1 item that is out of order and it always appears as the 2 or 3 barcode printed. Below is the code I use on the form to accomplish the printing.
I am running Access 07 and I am having a problem with my printing that is just baffling me.
I have a form that is used to view which items have been added to a que to receive a barcode. Here, quantities can be changed regarding how many of each item are without barcodes and items can also be removed.
When the user Clicks a "Print All" control the form feeds the first item in the que into a report, the report grabs the items barcode and prints through our barcode printer.
If the quantity is greater than 1 it repeats for whatever the quantity is, then when the quantity has been satisfied it moves on to a delete query that removes this item from the que.
The form moves through the entire table this way. Everything works fine accept I have an anomaly I can't put my finger on, for some reason it will print out of order and even though I've que'd the same items in the same way multiple times for testing it will sometimes work and then sometimes print out of order. It does not maintain consistency in that the same one is out of order all the time, it changes. The only consistency is that it is only 1 item that is out of order and it always appears as the 2 or 3 barcode printed. Below is the code I use on the form to accomplish the printing.
Code:
Dim stDocName as RptBarcode
DoCmd.GoToRecord , "", acFirst
For X = 1 To DCount("*", "tblPrintBarcodes")
If IsNull(Me.Quantity) Then
MsgBox "There cannot be a quantity less than 1. " _
& "Enter a quantity and try again."
Exit Sub
End If
For i = 1 To Me.Quantity
DoCmd.OpenReport stDocName, acNormal, , "lItemID=" & Me.lItemID
Next i
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE FROM tblPrintBarcodes WHERE [ID]=[Forms]![FrmPrintBarcodes]![ID]"
Requery
Next X