Hi all,
I am having a problem that is totally confusing me. I have a fairly simple access application that is linked to an sql server. When the user prints a couple of fields print out onto a label whose specifications have been loaded into the printer. I will say that this application worked fine for a couple of years. Then the users let it sit for about 3 months and now went to use it again and are having this problem.
We have tried reloading the printer and the label specifications but have ruled out a printer problem because the test page works correctly and so does printing from the mainframe. However, when the user prints from this application it prints the first label correctly then appears to skip about 2 labels then proceeds to print on the 3rd but the printing doesn't line up on the 3rd. One time the printing will be too high, another time too low. This makes me think that it isn't skipping exactly the length of 2 labels. The labels are 4" high and 5.9" wide. I looked and the report that is printing appears to be smaller than the label - 3.7083" high and 5.625" wide. I can't see how it could be the code but that's the only thing I have left. The code is attached below. Any ideas?
Thanks,
-Sandy
Private Sub cmdPrint_Click()
On Error GoTo RunTime_Error
'Opens up print report and fills info with selected info from this form
'Then prints the form X number of time per Qty entered
'Ensure that the correct Form name and Report name are entered below
Dim stFormName As String
Dim stReportName As String
Dim X As Integer
stFormName = "frmVolvoNoz"
stReportName = "rptVolvoNoz"
'Opens the form in Preview mode
DoCmd.OpenReport stReportName, acViewPreview
'Prints the label X times per Qty
DoCmd.PrintOut acPages, 1, 1, acMedium, Forms(stFormName).txtQty.Value
'Closes the Report, and gives message
DoCmd.Close acReport, stReportName, acSaveNo
MsgBox "The following was printed to the Printer:" & vbNewLine & _
"Part#: " & Forms(stFormName).cmbPartNum.Value & _
vbNewLine & "Qty: " & Forms(stFormName).txtQty.Value
'Resets the values on the form
Forms(stFormName).cmbPartNum.Value = ""
Forms(stFormName).txtQty.Value = "1"
Forms(stFormName).txtBox1.Value = Main.GetRemanCodePrefix
Forms(stFormName).txtBox2.Value = ""
Forms(stFormName).txtBox3.Value = ""
'Error Handling System Runtime
GoTo Sub_End
RunTime_Error:
Main.sErrorReport Err.Number, Err.Description, Err.Source, Me.Form.Name, "cmdPrint_Click"
Sub_End:
End Sub
I am having a problem that is totally confusing me. I have a fairly simple access application that is linked to an sql server. When the user prints a couple of fields print out onto a label whose specifications have been loaded into the printer. I will say that this application worked fine for a couple of years. Then the users let it sit for about 3 months and now went to use it again and are having this problem.
We have tried reloading the printer and the label specifications but have ruled out a printer problem because the test page works correctly and so does printing from the mainframe. However, when the user prints from this application it prints the first label correctly then appears to skip about 2 labels then proceeds to print on the 3rd but the printing doesn't line up on the 3rd. One time the printing will be too high, another time too low. This makes me think that it isn't skipping exactly the length of 2 labels. The labels are 4" high and 5.9" wide. I looked and the report that is printing appears to be smaller than the label - 3.7083" high and 5.625" wide. I can't see how it could be the code but that's the only thing I have left. The code is attached below. Any ideas?
Thanks,
-Sandy
Private Sub cmdPrint_Click()
On Error GoTo RunTime_Error
'Opens up print report and fills info with selected info from this form
'Then prints the form X number of time per Qty entered
'Ensure that the correct Form name and Report name are entered below
Dim stFormName As String
Dim stReportName As String
Dim X As Integer
stFormName = "frmVolvoNoz"
stReportName = "rptVolvoNoz"
'Opens the form in Preview mode
DoCmd.OpenReport stReportName, acViewPreview
'Prints the label X times per Qty
DoCmd.PrintOut acPages, 1, 1, acMedium, Forms(stFormName).txtQty.Value
'Closes the Report, and gives message
DoCmd.Close acReport, stReportName, acSaveNo
MsgBox "The following was printed to the Printer:" & vbNewLine & _
"Part#: " & Forms(stFormName).cmbPartNum.Value & _
vbNewLine & "Qty: " & Forms(stFormName).txtQty.Value
'Resets the values on the form
Forms(stFormName).cmbPartNum.Value = ""
Forms(stFormName).txtQty.Value = "1"
Forms(stFormName).txtBox1.Value = Main.GetRemanCodePrefix
Forms(stFormName).txtBox2.Value = ""
Forms(stFormName).txtBox3.Value = ""
'Error Handling System Runtime
GoTo Sub_End
RunTime_Error:
Main.sErrorReport Err.Number, Err.Description, Err.Source, Me.Form.Name, "cmdPrint_Click"
Sub_End:
End Sub