Hello all,
I have a form that is used to enter a work order. A work order contains various "stacks". In my form, the operator chooses the Work Order, and enters how many stacks are being built that day. The form then saves multiple records depending on stacks built THEN it should print a label for each dash number.
An example of how it would save is: W1234-1 then new record for W1234-2, new record for W1234-3 etc, until the dash number reaches the numbers of stacks built.
I have found this code in a database used here at work (might have been taken off the net):
Code:
Private Function PrintLabels() Dim Show_Box As Boolean
Dim Response As Variant
Dim i As Integer
Dim strWhereID As String
' Set the Show_Dialog variable to True.
Show_Box = True
' Begin While loop.
While Show_Box = True
' Show the input box.
Response = InputBox("Enter the number of labels to print or press Cancel to skip printing.", "Label Printing", 1)
' See if Cancel was pressed.
If Response = "" Then
' If Cancel was pressed,
' break out of the loop.
Show_Box = False
Else
' Test Entry to find out if it is numeric.
If IsNumeric(Response) = True Then
For i = 1 To Response
strID = "[ID]=" & Me.ID
DoCmd.OpenReport "SilverLabels", acViewPreview, , strWhereID
Next i
Show_Box = False
Else
' If the entry was wrong, show an error message.
MsgBox "Please Enter Numbers Only"
End If
End If
' End the While loop.
Wend
End Function
my form is not bound, i wanted to do everything with coding (for practice). Currently, it does not print and gives me a pop up for Enter ID.
any suggestions on how to go about this?
i hope my message is clear, i can explain further if needed.
Thank you all in advanced.