Well, while I have gone to a NUMBER of technical forums trying to get the
answer to the Tractor Feed Label Problem, no one seemed to have the answer I
was looking for. Many pointed to the OKIDATA ML591, others pointed to Access
2002 and in the end I still don’t have an answer.
However, since I did figure out a “brute force” method I thought I’d add it
here and on the other Forums as a way for you to deal with the issues and
perhaps you can come up with a more elegant solution and if so I’d truly
appreciate it if you’d send me the answers as well.
In essence what you’re going to see is that I create the labels in a loop,
and format the serial number (S/N) to our liking. Then I enumerate the
labels on the table and from there I simply do a filter that prints one
report (first 6 S/N labels) and then closes and prints another report (the
next 6 S/N labels) allowing the user to reset the printer’s position.
Since it is starting at the top of the page, there is no need to waste any
labels. Any and all suggestions are still not only welcomed, but also
desperately sought
[code]
Private Sub cmd_Gen_LabelSet_Click()
On Error GoTo Err_Gen_LabelSet_Click
Dim sSerialBase As String
Dim sModelNumber As String
Dim sSerialNumber As String
Dim sACvolt As String
Dim sACamp As String
Dim sPhase As String
Dim sCnt As String
Dim sHertz As String
Dim sDCVolts As String
Dim stDocName As String
Dim stCriteria As String
Dim iSeqStart As Integer
Dim iSeqEnd As Integer
Dim iLabelNumber As Integer
Dim iTotalLabels As Integer
Dim iNumberOfPages As Integer
Dim iPage As Integer
Dim iFirstLabel As Integer
Dim iLastLabel As Integer
DoCmd.OpenQuery "qryDEL_Old_Gen_Set", acNormal, acEdit
'this section opens up the labelgen database to stuff the label
'information into it
Dim db As DAO.Database
Dim rst As DAO.Recordset
' this section captures the data from the form
sSerialBase = [Base Serial Number]
iSeqStart = [Sequence Start]
iSeqEnd = [Sequence Finish]
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblLabel_gen", dbOpenDynaset)
'this section starts to generate the serial numbers
If IsNull([Hetz]) Then [Hetz] = " "
With rst
For cnt = iSeqStart To iSeqEnd ' sets up the serial number sequence
.AddNew ' opens the table to add new records
' This section Formats the Serial Number so that it has leading zeros
If cnt <= 9 Then sCnt = "00" & cnt
If cnt >= 10 And cnt < 100 Then sCnt = "0" & cnt
If cnt >= 100 Then sCnt = cnt
sSerialNumber = sSerialBase & sCnt ' stores the formated S/N
iLabelNumber = iLabelNumber + 1 ' Stores Label Count
' this section writes the data into the label database
![Label Number] = iLabelNumber
![Serial Number] = sSerialNumber
![Model Number] = [Model Number]
![AC Voltage] = [AC Voltage]
![AC Amps] = [AC Amps]
![Phase] = [Phase]
![Hetz] = [Hetz]
![DC Volts] = [DC Volts]
![Max DC Amps] = [Max DC Amps]
.Update 'without the Update statement it's not going to get stored
Next
End With
' capture the number of labels created
iTotalLabels = iLabelNumber
' see how many sets of reports (pages) must be printed
' each LETTER size page, will print 6 labels custom sized for our application
' the 5/6 addition at the end is to round up to the next full page
' 1 label of 6 (1/6) + (5/6) then the integer makes it a full page number
iNumberOfPages = Int((iTotalLabels / 6) + (5 / 6))
'print the pages
For iPage = 1 To iNumberOfPages
iLastLabel = iPage * 6 ' Define the last label on the page
iFirstLabel = iLastLabel - 6 ' subtract 6 to find the first label
stCriteria = "[Label Number] >" & iFirstLabel & _
"AND [Label Number] <=" & iLastLabel ' set the Filter for each
pass
MsgBox "ALERT!!!: ALIGN FOR NEXT LABEL SET" ' Alert the user to reset
the label indexing
stDocName = "Label 1"
'DoCmd.OpenReport stDocName, acPreview
DoCmd.OpenReport stDocName, acViewNormal, , stCriteria
Next
MsgBox "COMPLETE! - No More Labels To Print, Thank you and print again soon...
"
Exit_Gen_LabelSet_Click:
Exit Sub
Err_Gen_LabelSet_Click:
MsgBox Err.Description
Resume Exit_Gen_LabelSet_Click
End Sub
[/code]
Thanks to those who tried to help me out. And I'm still in need of a better
solution, because this requires too much human interface
Pampas58
>Some get caught between a "rock and a hard place", others between Access,
>Windows, and a printer, it seems. I wish I had a solution for you (other
[quoted text clipped - 12 lines]
>>> Larry Linson
>>> Microsoft Office Access MVP