Priinting from Form issue
Priinting from Form issue
We are using a form in Access to print labels out, which uses a button to print out the labels.
If I go to the report directly and go into print preview and then click print and select a new label printer it prints no problem at all
If I set the new printer as the windows default printer and then print from the form button, it tries to send the print to your printer, but then comes up with paper jam, I open the carriage and then close press feed and then it tries to print some more (appears to be trying to do this over several labels rather than one). Eventually after a few of these it finishes the job.
If I change the default printer back to the old printer it works no problem.
I have gone into the page set up and tried to set the default to the new printer but then it prints to the old one, ignoring the page set up default printer. This then made me think it was the code under the button which was set somehow to user the old printer. I cannot see anything in the code for the button that even relates to the old printer, (see code below, I pout it in as sql but it is an event procedure in Access wasn't sure how to copy it in)
I also have gone through the other modules but cannot seem to locate anything to do with printers.
CODE --> sql
Private Sub cmdPrintTicket_Click() Dim QRY As QueryDef Dim SQL As String Dim YesNo As Boolean YesNo = True With DoCmd If DLookup("[LabelPrinted]", "Packs", "[Output PackRef]='" & Me.cmbPackNumber & "'") = -1 Then If MsgBox("This tickets has been printed - are you sure?", vbInformation + vbYesNo, "Print Pack Tickets") = vbNo Then YesNo = False End If End If If YesNo Then ' update underlying query SQL = "SELECT Packs.ChargeNumber, " SQL = SQL & "Packs.[Input PackRef], Packs.[Output PackRef], " SQL = SQL & "Packs.Machine, Packs.ProcessDate, Packs.ProcessTime, Packs.OrderNumber, " SQL = SQL & "Packs.Customer, Packs.Product, " SQL = SQL & "Trim(CStr(Packs.Thickness))" & "& "" X "" & " & "Trim(CStr(Packs.Width)) AS Profile," SQL = SQL & "Packs.Species, ZN([Packs].[T18]) AS T18, ZN([Packs].[T21]) AS T21, ZN(Packs.T24) AS T24, ZN(Packs.T27) AS T27, ZN(Packs.T30) AS T30, ZN(Packs.T33) AS T33, ZN(Packs.T36) AS T36, ZN(Packs.T39) AS T39, ZN(Packs.T42) AS T42, ZN(Packs.T45) AS T45, ZN(Packs.T48) AS T48, ZN(Packs.T51) AS T51, ZN(Packs.T54) AS T54, ZN(Packs.T57) AS T57, ZN(Packs.T60) AS T60, ZN(Packs.T63) AS T63, Packs.Pieces, Packs.RunningMetres, Packs.Volume, " SQL = SQL & "FullSpecification(Packs.[Output PackRef]) AS Spec " SQL = SQL & "FROM Packs " SQL = SQL & "WHERE Packs.[Output PackRef]=[Forms]![frmMain]![cmbPacknumber]" Set QRY = CurrentDb().QueryDefs("qryPackTickets") QRY.SQL = SQL QRY.Close Set QRY = Nothing .OpenReport "Pack Ticket" .SetWarnings False .RunSQL "UPDATE Packs SET LabelPrinted = True WHERE [Output PackRef]='" & Me.cmbPackNumber & "'" .SetWarnings True End If End With End Sub
Any ideas please. Thanks